1 // YAML error class. http://stackoverflow.com/questions/8458984
5 function YAMLException(reason, mark) {
9 // Include stack trace in error object
10 if (Error.captureStackTrace) {
12 Error.captureStackTrace(this, this.constructor);
14 // FF, IE 10+ and Safari 6+. Fallback for others
15 this.stack = (new Error()).stack || '';
18 this.name = 'YAMLException';
21 this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
26 YAMLException.prototype = Object.create(Error.prototype);
27 YAMLException.prototype.constructor = YAMLException;
30 YAMLException.prototype.toString = function toString(compact) {
31 var result = this.name + ': ';
33 result += this.reason || '(unknown reason)';
35 if (!compact && this.mark) {
36 result += ' ' + this.mark.toString();
43 module.exports = YAMLException;