ReportDesignerClientSideModelGenerator.CreateErrorJson(Exception) Method

Creates the JSON string with the error that can occur when generating a client-side Report Designer model.

Namespace: DevExpress.XtraReports.Web.ReportDesigner

Assembly: DevExpress.XtraReports.v18.1.Web.dll

Declaration

public string CreateErrorJson(
    Exception exception
)
Public Function CreateErrorJson(
    exception As Exception
) As String

Parameters

Type Name Description
Exception exception

A Exception object that specifies the exception based on which the JSON string should be created.

Returns

Type Description
String

A string with the error information serialized to the JSON format.

The following code demonstrates how to use this method to return the error if an exception occurs when using the GetJsonModelScript method.

public ActionResult GetReportDesignerModel(string reportUrl) {
    try {
        //...
        string modelJsonScript = new ReportDesignerClientSideModelGenerator().GetJsonModelScript(...);
        return Content(modelJsonScript, "application/json");
    }
    catch(Exception exception) {
        string errorJson = new ReportDesignerClientSideModelGenerator().CreateErrorJson(exception);
        return Content(errorJson, "application/json");
    }
}