mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-23 04:04:38 +02:00
errors
This commit is contained in:
parent
010ef3c6a3
commit
d748457d1c
2 changed files with 1 additions and 50 deletions
45
src/errors/index.js
Normal file
45
src/errors/index.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
var MyError = Backbone.Model.extend({
|
||||
defaults: {
|
||||
type: 'MyError',
|
||||
msg: 'Unknown Error'
|
||||
},
|
||||
toString: function() {
|
||||
return this.get('type') + ': ' + this.get('msg');
|
||||
},
|
||||
|
||||
getMsg: function() {
|
||||
return this.get('msg') || 'Unknown Error';
|
||||
},
|
||||
|
||||
toResult: function() {
|
||||
if (!this.get('msg').length) {
|
||||
return '';
|
||||
}
|
||||
return '<p>' + this.get('msg').replace(/\n/g, '</p><p>') + '</p>';
|
||||
}
|
||||
});
|
||||
|
||||
var CommandProcessError = exports.CommandProcessError = MyError.extend({
|
||||
defaults: {
|
||||
type: 'Command Process Error'
|
||||
}
|
||||
});
|
||||
|
||||
var CommandResult = exports.CommandResult = MyError.extend({
|
||||
defaults: {
|
||||
type: 'Command Result'
|
||||
}
|
||||
});
|
||||
|
||||
var Warning = exports.Warning = MyError.extend({
|
||||
defaults: {
|
||||
type: 'Warning'
|
||||
}
|
||||
});
|
||||
|
||||
var GitError = exports.GitError = MyError.extend({
|
||||
defaults: {
|
||||
type: 'Git Error'
|
||||
}
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue