ContentstackException

View as Markdown

ContentstackException

ContentstackException is the exception the SDK throws when a request fails, in the Contentstack.Core.Internals namespace. It extends System.Exception and is the base class of seven more specific exceptions. Use this class to

  • catch every request failure from the SDK in one catch block
  • read the API error code, the HTTP status, and the per-field messages of a rejected request

Catch ContentstackException unless your code handles one failure differently from another. Every subclass below carries the same properties.

NameTypeDescription
Message string

Read-only. The API's error_message, or a description of the failure.

ErrorCode int

The API's error_code. 0 when no API error body arrived.

StatusCode HttpStatusCode

The HTTP status of the response.

Errors Dictionary<string, object>

The API's errors object: one list of messages per field.