Skip to main content

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.v23.2.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public string CreateErrorJson(
    Exception exception
)

Parameters

Name Type 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.

Remarks

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");
    }
}
See Also