This repository has been archived by the owner on Sep 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy patherrors.js
82 lines (73 loc) · 2.94 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
var TypedError = require('error/typed');
var InvalidDirname = TypedError({
type: 'missing.dirname.argument',
message: 'invalid __dirname argument.\n' +
'Must call fetchConfig(__dirname).\n' +
'__dirname should be a string and is non-optional.\n' +
'instead I got {strDirname}.\n' +
'SUGGESTED FIX: update the `fetchConfig()` callsite.\n'
});
var MissingDatacenter = TypedError({
type: 'missing.datacenter.file',
warning: true,
message: 'no such file or directory \'{path}\'.\n' +
'expected to find datacenter configuration at {path}.\n'
});
var DatacenterRequired = TypedError({
type: 'datacenter.option.required',
message: 'expected `opts.dcValue` to be passed to fetchConfig.\n' +
'must call `fetchConfig(__dirname, { dcValue: "..." }).\n' +
'instead I got opts: {strOpts}.\n' +
'`opts.dcValue` is not optional when NODE_ENV is "production".\n' +
'SUGGESTED FIX: update the `fetchConfig()` callsite.\n'
});
var NonexistantKeyPath = TypedError({
type: 'nonexistant.key.path',
message: 'attempting to get a nonexistant keyPath.\n' +
'Expected the key: {keyPath} to be found.\n' +
'SUGGESTED FIX: add {keyPath} and value to config'
});
var DatacenterFileRequired = TypedError({
type: 'datacenter.file.required',
message: 'no such file or directory \'{path}\'.\n' +
'expected to find datacenter configuration at {path}.\n' +
'when NODE_ENV is "production" the datacenter file must exist.\n' +
'SUGGESTED FIX: configure your system so it has a datacenter file.\n'
});
var InvalidKeyPath = TypedError({
type: 'invalid.keypath',
message: 'specified an invalid keypath to `config.set()`.\n' +
'expected a string but instead got {keyPath}.\n' +
'SUGGESTED FIX: update the `config.set()` callsite.\n'
});
var InvalidMultiSetArgument = TypedError({
type: 'invalid.multi.set',
message: 'Invalid `config.set(obj)` argument.\n' +
'expected an object but instead got {objStr}.\n' +
'SUGGESTED FIX: update the `config.set()` callsite to ' +
'be a valid object.\n',
objStr: null,
obj: null
});
var SetFrozenObject = TypedError({
type: 'set.frozen.object',
message: 'Cannot `config.set(key, value)`. Config is ' +
'frozen.\n' +
'expected `config.set()` not to be called. Instead ' +
'it was called with {keyPath} and {valueStr}.\n' +
'SUGGESTED FIX: Do not call `config.set()` it was ' +
'frozen by someone else.\n',
keyPath: null,
valueStr: null,
value: null
});
module.exports = {
InvalidDirname: InvalidDirname,
MissingDatacenter: MissingDatacenter,
DatacenterRequired: DatacenterRequired,
DatacenterFileRequired: DatacenterFileRequired,
InvalidKeyPath: InvalidKeyPath,
NonexistantKeyPath: NonexistantKeyPath,
InvalidMultiSetArgument: InvalidMultiSetArgument,
SetFrozenObject: SetFrozenObject
};