Handle errors using the PSVError class
The
PSVError class is used by Photo Sphere Viewer to throw library-specific errors. It extends the standard JavaScript Error object and allows for an optional reason parameter to provide additional context about why the error occurred.// Creating a new PSVError
const error = new PSVError('An error occurred', { detail: 'Invalid image format' });
console.log(error.message);
console.log(error.name);
console.log(error.stack);