Options
All
  • Public
  • Public/Protected
  • All
Menu

General unblu JS API error class that will be thrown whenever something goes wrong.

Check the documentation of UnbluErrorType for more details on the different error types.

Example:

unblu.api.initialize().then(api => {
// use the api
}).catch(e => {
if(e.type === 'INITIALIZATION_TIMEOUT') {
//retry
} else if(e.type === 'UNSUPPORTED_BROWSER') {
// display unsupported browser dialog
} else {
// show generic error message
}
})

or using async / await:

try {
const api = await unblu.api.initialize()
// use the api
} catch(e) {
if(e.type === 'INITIALIZATION_TIMEOUT') {
//retry
} else if(e.type === 'UNSUPPORTED_BROWSER') {
// display unsupported browser dialog
} else {
// show generic error message
}
}

The error types may either be checked via their constant string values or via the UnbluErrorType enum:

// using string constant
function isTimeout(e: UnbluApiError) {
return e.type === 'INITIALIZATION_TIMEOUT'
}
// using the enum
function isTimeout(e: UnbluApiError) {
return e.type === window.unblu.UnbluErrorType.INITIALIZATION_TIMEOUT
}

Hierarchy

  • Error
    • UnbluApiError

Index

Constructors

Properties

Constructors

  • Parameters

    Returns UnbluApiError

Properties

detail: string