Created
August 28, 2013 18:58
-
-
Save craigmaslowski/6369856 to your computer and use it in GitHub Desktop.
backbone.error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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