1 // YAML error class. http://stackoverflow.com/questions/8458984
5 function YAMLException(reason, mark) {
9 this.name = 'YAMLException';
12 this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
14 // Include stack trace in error object
15 if (Error.captureStackTrace) {
17 Error.captureStackTrace(this, this.constructor);
19 // FF, IE 10+ and Safari 6+. Fallback for others
20 this.stack = (new Error()).stack || '';
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;