Skip to content

Instantly share code, notes, and snippets.

@craigmaslowski
Created August 28, 2013 18:58
Show Gist options
  • Save craigmaslowski/6369856 to your computer and use it in GitHub Desktop.
Save craigmaslowski/6369856 to your computer and use it in GitHub Desktop.
backbone.error.js
Backbone.Error = function (message, obj) {
var type;
// TODO: Clean this up.
if (obj instanceof Backbone.Model) {
type = 'model';
} else if (obj instanceof Backbone.View) {
type = 'view';
} else if (obj instanceof Backbone.Collection) {
type = 'collection';
}
// TODO: improve the data that's reported.
message += '\nThrown by ' + type + ' with cid: ' + obj.cid;
throw new Error(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment