This repository was archived by the owner on Oct 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patherrors.js
90 lines (84 loc) · 1.97 KB
/
errors.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
'use strict'
/**
* Exception raised when trying to revert migration that is not possible
* to revert.
*/
class NonReversibleMigrationError extends Error {
/**
* @param {string} message
*/
constructor (message) {
super(message)
this.name = 'NonReversibleMigrationError'
this.code = 'ERR_NON_REVERSIBLE_MIGRATION'
this.message = message
}
}
NonReversibleMigrationError.code = 'ERR_NON_REVERSIBLE_MIGRATION'
/**
* Exception raised when repo is not initialized.
*/
class NotInitializedRepoError extends Error {
/**
* @param {string} message
*/
constructor (message) {
super(message)
this.name = 'NotInitializedRepoError'
this.code = 'ERR_NOT_INITIALIZED_REPO'
this.message = message
}
}
NotInitializedRepoError.code = 'ERR_NOT_INITIALIZED_REPO'
/**
* Exception raised when required parameter is not provided.
*/
class RequiredParameterError extends Error {
/**
* @param {string} message
*/
constructor (message) {
super(message)
this.name = 'RequiredParameterError'
this.code = 'ERR_REQUIRED_PARAMETER'
this.message = message
}
}
RequiredParameterError.code = 'ERR_REQUIRED_PARAMETER'
/**
* Exception raised when value is not valid.
*/
class InvalidValueError extends Error {
/**
* @param {string} message
*/
constructor (message) {
super(message)
this.name = 'InvalidValueError'
this.code = 'ERR_INVALID_VALUE'
this.message = message
}
}
InvalidValueError.code = 'ERR_INVALID_VALUE'
/**
* Exception raised when config is not passed.
*/
class MissingRepoOptionsError extends Error {
/**
* @param {string} message
*/
constructor (message) {
super(message)
this.name = 'MissingRepoOptionsError'
this.code = 'ERR_MISSING_REPO_OPTIONS'
this.message = message
}
}
MissingRepoOptionsError.code = 'ERR_MISSING_REPO_OPTIONS'
module.exports = {
NonReversibleMigrationError,
NotInitializedRepoError,
RequiredParameterError,
InvalidValueError,
MissingRepoOptionsError
}