Passed
Pull Request — master (#189)
by
unknown
01:37
created

ValidationError.constructor   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
1
'use strict';
2
3
const OAuthError = require('./OAuthError');
4
5
/**
6
 * Error class for validation related errors
7
 * @extends OAuthError
8
 */
9
class ValidationError extends OAuthError {
10
  /**
11
   * Create a new ValidationError
12
   * @param {string} message - Error message
13
   * @param {string} [code] - Error code
14
   * @param {string} [description] - Error description
15
   * @param {string} [intuitTid] - Intuit transaction ID
16
   */
17
  constructor(message, code, description, intuitTid) {
18
    super(message, code || 'VALIDATION_ERROR', description || message, intuitTid);
19
    this.name = 'ValidationError';
20
    Object.setPrototypeOf(this, ValidationError.prototype);
21
  }
22
}
23
24
module.exports = ValidationError;