-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.js
More file actions
85 lines (77 loc) · 2.26 KB
/
exceptions.js
File metadata and controls
85 lines (77 loc) · 2.26 KB
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
'use strict';
/**
* Thrown when the properties file for opsview doesn't exist.
* It is a requirement of the library for this file to exist in
* $HOME/.opsview_secret.
*/
class OpsviewPropertiesFileNotFoundError extends Error {
constructor(message){
super(message);
}
}
/**
* This exception is thrown while trying to authenticate with the
* opsview REST API.
*/
class OpsviewAuthenticationError extends Error {
constructor(message){
super(message);
}
}
/**
* This is thrown when an interaction with the Opsview REST API
* results in a server error.
* Provides a detail attribute to inspect in greater detail the
* error.
*/
class OpsviewApiError extends Error {
/**
* @constructor
* @param opsviewApiError {object} - as returned by the API server.
*/
constructor(opsviewApiError){
super(opsviewApiError.message);
this.detail = opsviewApiError.detail;
}
/**
* Returns the detail of the API Error.
* @return {string}
*/
getDetail(){
return this.detail;
}
}
/**
* Thrown when the user tries to instance an opsview object for a
* version that is not implemented.
*/
class OpsviewVersionNotSupportedError extends Error {
constructor(message){
super(message);
}
}
/**
* Thrown when the user tries to call a method for which the opsview
* version is not giving support.
*/
class OpsviewVersionDoesNotSupportMethodError extends Error {
constructor(message){
super(message);
}
}
/**
* Thrown when an attempt to reload the opsview configuration
* is performed but the server notifies that an Opsview Config Reload
* is already being performed.
*/
class OpsviewReloadAlreadyInPlace extends Error {
constructor(message){
super(message);
}
}
exports.OpsviewPropertiesFileNotFoundError = OpsviewPropertiesFileNotFoundError;
exports.OpsviewAuthenticationError = OpsviewAuthenticationError;
exports.OpsviewVersionNotSupportedError = OpsviewVersionNotSupportedError;
exports.OpsviewVersionDoesNotSupportMethodError = OpsviewVersionDoesNotSupportMethodError;
exports.OpsviewApiError = OpsviewApiError;
exports.OpsviewReloadAlreadyInPlace = OpsviewReloadAlreadyInPlace;