onWarning / onError callbacks

  1. onWarning
  2. Warning codes
  3. onError callback
  4. Error codes reference

onWarning

The onWarning callback returns information about a soft error that doesn’t impact the normal usage of the editor. You can use this callback to track these errors, display a message or change any behavior in your application. The callback manages JSON as the output data format.

Configuration

To handle these warnings, add the onWarning callback to beeConfig:




onWarning: function(errorMessage) { /* Implements function to handle warning responses */ }


Response




{
    "code": alfanumeric,
    "message": string
}


Example



{
    "code": 1000,
    "message": "Cannot call "send" while template is still loading."
}


Warning codes

Code Message Detail
1000 bee.save is unavailable
  • Cannot call bee.save() while template is still loading. Use the onLoad callback to determine when it’s safe to use the save method.
  • After onLoad(), if bee.save() is not accessible, it’s due to an expired token.
1001 AMP content detected The template loaded in the editor contains AMP content, but the editor is not configured with an AMP-compatible workspace. You can react to this warning by loading a workspace, using the loadWorkspace(type) method.

Message: AMP content has been loaded

1002 Workspace not available in current plan The workspace you have configured for the editor is not available for your subscription plan.

Message: Workspaces not available in [${payload}] plan

2000 Generic Bump Error [Template validation] Default generic bump error
2100 Invalid Target Version [Template validation] The target version does not exists
2200 [validation error detail] [Template validation] The JSON didn’t pass the validation.
The cause may be:

  • Missing keys
  • Added unknown keys

Message e.g.: required key not provided @ data[u'page'][u'body'][u'content'][u'style'][u'color']

2300 Missing Template Version [Template validation] There is no template version in the page
2400 Invalid Template Version [Template validation] There is no template version in the page
2500 Transformation Error [Template validation] Issues during JSON version migration
2600 Backward Transformation Error [Template validation] Issues during JSON version migration
3000 Service Error [Template validation] System failure not related with invalid json files

onError callback

The onError callback returns information about the application errors. You can use this callback to track these errors, display a message or change any behavior in your application. The callback manages JSON as the output data format.

Configuration

To handle these errors, add the onWarning callback to beeConfig:




onError: function(errorMessage) { /* Implements function to handle error messages */ } // [optional]


Response




{
    "code": alfanumeric,
    "message": string,
    "detail": string
}


Example



{
    "code": 1200,
    "message": "Template cannot be saved."
    "detail": "Type mismatch: scope is undefined"
}


Error codes reference

Please refer to the following pages to have the full list of error codes: