Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.v24.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