Error provides support for capturing application errors and sending them to a remote server, located at damnit.jupiterit.com, where the free notification service DamnIT sends the developer an email notification.
try {
this.will.cause.an.error();
} catch(e) {
ApplicationError.notify(e);
}
ApplicationError.config(options) -> undefined
Configures error popup window. If activated, the popup window prompts users immediately after an error occurs to explain their actions preceding the error. This information is packaged with the error and sent to the developer.
ApplicationError.config({prompt_user: false});
ApplicationError.config({
prompt_text: 'DAMN IT YOU BROKE IT!',
textarea_title: 'Please explain.',
close_time: 4
});
| Option | Default | Description |
|---|---|---|
| prompt_user | true | Whether to prompt the user for information. If this is false, the notification email will be sent silently with no user interruption. |
| prompt_text | "Something just went wrong. Please describe your most recent actions and let us know what happened. We'll fix the problem." | The explanation that a user sees in the prompt window. This should explain what you want them to type before sending the error notification. |
| textarea_title | "Damn It!" | The title of the prompt box. |
| close_time | 10 | Number of seconds before the prompt box will be closed and the email sent if the user hasn't typed anything in it. |
ApplicationError.initialize(options) -> ApplicationError
This is the constructor for the ApplicationError class. Each instance can be sent off to the DamnIT servers by calling send on it.
var notification = new ApplicationError({
subject: "test",
content: "someone clicked the new widget"
});
notification.save();
ApplicationError.notify(error) -> undefined
Prompts the user for information on their recent actions and sends a message to the DamnIT servers, which send a notification email to the developer. You can add information to the error object passed into notify to add to your notification email.
try {
this.will.cause.an.error();
} catch(e) {
e.username = 'Brian';
ApplicationError.notify(e);
}
error.send() -> undefined
Sends the ApplicationError object to the DamnIT servers. It should contain a subject and content attribute to send correctly.