Error

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.

config, initialize, notify, save

Example

try {
   this.will.cause.an.error();
} catch(e) {
   ApplicationError.notify(e);
}

Class Methods

config

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
});

options

OptionDefaultDescription
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.

initialize

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();
- subject and content make up the eventual subject and content of the notification email

notify

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);
}

- an object, usually this will be an error object that has been caught in a try...catch block

Prototype Methods

save

error.send() -> undefined

Sends the ApplicationError object to the DamnIT servers. It should contain a subject and content attribute to send correctly.