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 }}) Copy
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 }} Copy
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 constantfunction isTimeout(e: UnbluApiError) { return e.type === 'INITIALIZATION_TIMEOUT'} Copy
// using string constantfunction isTimeout(e: UnbluApiError) { return e.type === 'INITIALIZATION_TIMEOUT'}
// using the enumfunction isTimeout(e: UnbluApiError) { return e.type === window.unblu.UnbluErrorType.INITIALIZATION_TIMEOUT} Copy
// using the enumfunction isTimeout(e: UnbluApiError) { return e.type === window.unblu.UnbluErrorType.INITIALIZATION_TIMEOUT}
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:
or using async / await:
The error types may either be checked via their constant string values or via the UnbluErrorType enum: