All files / node_modules/js-yaml/lib/js-yaml exception.js

83.33% Statements 5/6
0% Branches 0/10
0% Functions 0/1
83.33% Lines 5/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44    1x                                             1x 1x     1x                         1x  
// YAML error class. http://stackoverflow.com/questions/8458984
//
'use strict';
 
function YAMLException(reason, mark) {
  // Super constructor
  Error.call(this);
 
  this.name = 'YAMLException';
  this.reason = reason;
  this.mark = mark;
  this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
 
  // Include stack trace in error object
  if (Error.captureStackTrace) {
    // Chrome and NodeJS
    Error.captureStackTrace(this, this.constructor);
  } else {
    // FF, IE 10+ and Safari 6+. Fallback for others
    this.stack = (new Error()).stack || '';
  }
}
 
 
// Inherit from Error
YAMLException.prototype = Object.create(Error.prototype);
YAMLException.prototype.constructor = YAMLException;
 
 
YAMLException.prototype.toString = function toString(compact) {
  var result = this.name + ': ';
 
  result += this.reason || '(unknown reason)';
 
  if (!compact && this.mark) {
    result += ' ' + this.mark.toString();
  }
 
  return result;
};
 
 
module.exports = YAMLException;