Handling errors

You can handle errors occurred in the Shakr Editor SDK by using editor.on('error', ...).

const editor = await createShakrEditor({...});
editor.on('error', e => {
switch (e.type) {
default:
console.log(e.type);
break;
}
);

Type of errors#

You can explore the full list of errors in the ShakrEditorError Enum document of the SDK Reference section.

rendering#

This error occurs as the video cannot be edited while being rendered.

archived#

This error occurs as a previously downloaded RenderSession cannot be edited.

no_permission#

This error occurs as the access token used in the editor does not have control over a particular RenderSession.

template_unavailable#

This error occurs when the Creative Template used for the RenderSession is not usable.

Sample code#

const editor = await createShakrEditor({...});
editor.on('error', e => {
switch (e.type) {
case 'rendering':
console.warn('Cannot edit this render session, it has being rendered!');
break;
case 'archived':
console.error('Cannot edit this render session, it has been archived.');
break;
case 'no_permission':
console.error('You do not have permission to edit this render session');
break;
case 'template_unavailable':
console.error('The video design used for this render session is no longer available.');
break;
default:
// For future compatibility, make sure to handle "unknown" errors too.
break;
}
})

Please refer to Reference for more information.