- Warnings: Non-critical issues that do not interrupt normal execution. These are logged to the console using
console.warn()orconsole.error(), depending on severity. - Unexpected Errors: Indicate incorrect or unsupported use of the SDK. These are thrown as standard JavaScript
Errorinstances with descriptive messages to help identify the problem. - API Errors: Occur when a request to Smile’s API fails. These are thrown as
ApiErrorinstances, which extend the nativeErrorclass and include additional details about the HTTP response and API context (see ApiError object).
Determining the type of error
The best way to differentiate between the two types of error objects that may be thrown depends on your build environment:- In a typed environment, use
ApiError.isApiError(). - In a non-typed environment, check for the presence of a
statusproperty on the error object. If it’s present and has a numeric value, then it’s an API error.