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 for the Floating API:
unblu.floating.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.floating.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.floating.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.floating.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 for the Floating API:
or using async / await:
The error types may either be checked via their constant string values or via the UnbluErrorType enum: