All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

JsonDataSourceException Class

An exception that occurs when an attempt to fill a JsonDataSource with data fails.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v20.1.dll

Declaration

public class JsonDataSourceException :
    Exception
Public Class JsonDataSourceException
    Inherits Exception

Remarks

The JsonDataSourceException is thrown when a call to the Fill() method fails to populate the data source with data and supercedes the following exceptions:

  • WebExceptions that occur when the endpoint's Uri is not accessible.
  • IOExceptions that occur on failed attempts to load JSON data from the file system.
  • JSON data parse errors.

Enclose the JsonDataSource.Fill method call in the try block and catch JsonDataSourceException:

try {
  dataSource.Fill()
}
catch(JsonDataSourceException) {
  //do something
}

As an alternative to catching JsonDataSourceException, you can handle the JsonDataSource.FillError event to process WebException, IOException, and JSON data parse errors.

Example

The code sample below creates a new data source, calls the Fill method to populate the data source with data, and catches the JsonDataSourceException exception that may occur during the Fill method call.

using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
// ...
// Create a new JSON source.
var jsonSource = new UriJsonSource() {
    Uri = new Uri(@"https://invalid.json")
};
// Assign the JSON source to the data source.
var datasource = new JsonDataSource() {
    JsonSource = jsonSource
};
try {
    datasource.Fill();
}
catch (JsonDataSourceException) {
    // Add code to process JsonDataSourceException here.
}

Inheritance

Object
Exception
JsonDataSourceException
See Also