Exceptions
The JavaScript SDK comes with custom exception classes for better error handling and abstracting certain implementation-specific exceptions.
All SDK exceptions should be serializable (they are marked Serializable and override the Serializable constructor). Furthermore, all SDK exceptions implement the three default Exception constructors.
AuthenticationError
This exception is used for all authentication related errors. Note that this exception can happen at many places in the SDK, and is therefore not listed in the documentation of every method.
ForbiddenError
This exception is used for all authorization related errors. Note that this exception can happen at many places in the SDK, and is therefore not listed in the documentation of every method.
InternalError
The InternalError is thrown when problems occur in the SDK and is usually a bug.
NotFoundError
The NotFoundError is thrown when a certain resource is required but cannot be found.
ValidationError
This exception is used for all validation related errors. For example, it is thrown when an object, such as an entity, is being persisted but does not pass the validation.
The ValidationError's message can be useful to understand the reason behind it.