File size: 783 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { ErrorTypeEnum } from '../../../utils/error-type.enum.js'
import * as CONSTANTS from '../../../constants.js'

const buildUrl = (page: string): string => (
  `${CONSTANTS.DOCS}/${page}`
)

/**
 * Error which is thrown when user messed up something in the configuration
 *
 * @category Errors
 */
export class ConfigurationError extends Error {
  /**
   * @param   {string}  fnName  name of the function, base on which error will
   * print on the output link to the method documentation.
   * @param {string} message
   */
  constructor(message, fnName) {
    const msg = `
    ${message}
    More information can be found at: ${buildUrl(fnName)}
    `
    super(msg)
    this.message = msg
    this.name = ErrorTypeEnum.Configuration
  }
}

export default ConfigurationError