Skip to content

Instantly share code, notes, and snippets.

@smalljam
Created December 17, 2011 14:35
Show Gist options
  • Save smalljam/1490346 to your computer and use it in GitHub Desktop.
Save smalljam/1490346 to your computer and use it in GitHub Desktop.
Custom exceptions generator
(function(ns){
function createException(name) {
ns[name] = function(text) {
var r = Error.call(this, text);
r.name = name;
return r;
};
}
createException('RedefineException');
createException('WrongTypeException');
createException('ConfigurationMissingException');
}(this));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment