I use JsonTemplateException instead of just throwing objects, so
things are dealt with better in Firebug....


function JsonTemplateException(message) {
        if (Ext.isObject(message)) {
                this.message = message.message;
                this.name = message.name;
        }
        else {
                this.message = message;
                this.name = "JsonTemplateException";
        }
}

// Make the exception convert to a pretty string when used as
// a string (e.g. by the error console)
JsonTemplateException.prototype.toString = function() {
        return this.name + ': "' + this.message + '"';
}



An example:

function GetFormatter(format_str) {
...
throw new JsonTemplateException({
        name: 'BadFormatter',
        message: format_str + ' is not a valid formatter'
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON 
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to