Kenspeckled/oomph

View on GitHub
lib/ValidationError.js

Summary

Maintainability
A
0 mins
Test Coverage
// Generated by CoffeeScript 1.9.3
(function() {
  var ValidationError,
    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;

  ValidationError = (function(superClass) {
    extend(ValidationError, superClass);

    function ValidationError(message, args) {
      this.name = 'ValidationError';
      this.message = message;
      if (args.attribute) {
        this.attribute = args.attribute;
      }
      if (args.expected) {
        this.expected = args.expected;
      }
      if (args.actual) {
        this.actual = args.actual;
      }
      if (args.errorType) {
        this.errorType = args.errorType;
      }
    }

    return ValidationError;

  })(Error);

  module.exports = ValidationError;

}).call(this);