Skip to main content

Handling Errors

When an error occurs inside View360, a View360Error containing a predefined code is thrown.
If necessary, you can handle the error based on the corresponding code value.
Check the ERROR_CODES for a list of possible code values.

Below is an example of that.

import View360, { View360Error, ERROR_CODES } from "@egjs/view360";

try {
const viewer = new View360("#wrapper");
} catch (err) {
if (err instanceof View360Error && err.code === ERROR_CODES.ELEMENT_NOT_FOUND) {
// No element corresponding to "#wrapper" was found.
}
}