exception.js 454 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. function YAMLException(reason, mark) {
  3. this.name = 'YAMLException';
  4. this.reason = reason;
  5. this.mark = mark;
  6. this.message = this.toString(false);
  7. }
  8. YAMLException.prototype.toString = function toString(compact) {
  9. var result;
  10. result = 'JS-YAML: ' + (this.reason || '(unknown reason)');
  11. if (!compact && this.mark) {
  12. result += ' ' + this.mark.toString();
  13. }
  14. return result;
  15. };
  16. module.exports = YAMLException;