@cumulus/errors 9.7.0 → 9.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -39
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,13 +8,14 @@ exports.IndexExistsError = exports.PostgresUpdateFailed = exports.PostgresValida
|
|
|
8
8
|
* @param ParentType - The error that serves as the parent
|
|
9
9
|
* @returns The new type
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
const createErrorType = (name, ParentType = Error) => (class extends ParentType {
|
|
12
12
|
constructor(message) {
|
|
13
13
|
super(message);
|
|
14
14
|
this.name = name;
|
|
15
15
|
Error.captureStackTrace(this, this.constructor);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
exports.createErrorType = createErrorType;
|
|
18
19
|
class ThrottlingException extends Error {
|
|
19
20
|
constructor() {
|
|
20
21
|
super('ThrottlingException');
|
|
@@ -27,83 +28,86 @@ exports.ThrottlingException = ThrottlingException;
|
|
|
27
28
|
/**
|
|
28
29
|
* Test to see if a given exception is an AWS Throttling Exception
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
const isThrottlingException = (err) => err.code === 'ThrottlingException';
|
|
32
|
+
exports.isThrottlingException = isThrottlingException;
|
|
31
33
|
/**
|
|
32
34
|
* Returns true if the error is a resource error.
|
|
33
35
|
*/
|
|
34
|
-
|
|
36
|
+
const isWorkflowError = (error) => error.name.includes('WorkflowError');
|
|
37
|
+
exports.isWorkflowError = isWorkflowError;
|
|
35
38
|
/**
|
|
36
39
|
* Returns true if the error is a DynamoDB conditional check exception.
|
|
37
40
|
*/
|
|
38
|
-
|
|
41
|
+
const isConditionalCheckException = (error) => error.code === 'ConditionalCheckFailedException';
|
|
42
|
+
exports.isConditionalCheckException = isConditionalCheckException;
|
|
39
43
|
/**
|
|
40
44
|
* WorkflowError should be bubbled out to the overall workflow in the 'exception' field, rather than
|
|
41
45
|
* being thrown and causting an immediate failure
|
|
42
46
|
*/
|
|
43
|
-
exports.WorkflowError = exports.createErrorType('WorkflowError');
|
|
47
|
+
exports.WorkflowError = (0, exports.createErrorType)('WorkflowError');
|
|
44
48
|
/**
|
|
45
49
|
* NotNeededError indicates that execution was not completed because it was unnecessary. The
|
|
46
50
|
* workflow should therefore terminate but be considered successful
|
|
47
51
|
*/
|
|
48
|
-
exports.NotNeededError = exports.createErrorType('NotNeededWorkflowError', exports.WorkflowError);
|
|
52
|
+
exports.NotNeededError = (0, exports.createErrorType)('NotNeededWorkflowError', exports.WorkflowError);
|
|
49
53
|
/**
|
|
50
54
|
* IncompleteError indicates that the execution was partially successful and can be re-executed to
|
|
51
55
|
* make further progress. This may happen, for instance, if an execution timeout stops progress
|
|
52
56
|
*/
|
|
53
|
-
exports.IncompleteError = exports.createErrorType('IncompleteWorkflowError', exports.WorkflowError);
|
|
57
|
+
exports.IncompleteError = (0, exports.createErrorType)('IncompleteWorkflowError', exports.WorkflowError);
|
|
54
58
|
/**
|
|
55
59
|
* ResourcesLockedError indicates that the execution is unable to proceed due to resources being
|
|
56
60
|
* tied up in other executions. Execution may be retried after resources free up
|
|
57
61
|
*/
|
|
58
|
-
exports.ResourcesLockedError = exports.createErrorType('ResourcesLockedWorkflowError', exports.WorkflowError);
|
|
62
|
+
exports.ResourcesLockedError = (0, exports.createErrorType)('ResourcesLockedWorkflowError', exports.WorkflowError);
|
|
59
63
|
/**
|
|
60
64
|
* RemoteResourceError indicates that a required remote resource could not be fetched or otherwise
|
|
61
65
|
* used
|
|
62
66
|
*/
|
|
63
|
-
exports.RemoteResourceError = exports.createErrorType('RemoteResourceError');
|
|
67
|
+
exports.RemoteResourceError = (0, exports.createErrorType)('RemoteResourceError');
|
|
64
68
|
/**
|
|
65
69
|
* The error object for when the xml file path is not provided
|
|
66
70
|
*/
|
|
67
|
-
exports.XmlMetaFileNotFound = exports.createErrorType('XmlMetaFileNotFound');
|
|
71
|
+
exports.XmlMetaFileNotFound = (0, exports.createErrorType)('XmlMetaFileNotFound');
|
|
68
72
|
/**
|
|
69
73
|
* No CMR metadata file was present.
|
|
70
74
|
*/
|
|
71
|
-
exports.CMRMetaFileNotFound = exports.createErrorType('CMRMetaFileNotFound');
|
|
75
|
+
exports.CMRMetaFileNotFound = (0, exports.createErrorType)('CMRMetaFileNotFound');
|
|
72
76
|
/**
|
|
73
77
|
* CMR returned an internal server error
|
|
74
78
|
*/
|
|
75
|
-
exports.CMRInternalError = exports.createErrorType('CMRInternalError');
|
|
79
|
+
exports.CMRInternalError = (0, exports.createErrorType)('CMRInternalError');
|
|
76
80
|
/**
|
|
77
81
|
* Distribution bucket map is missing a configured value for a distribution bucket
|
|
78
82
|
*/
|
|
79
|
-
exports.MissingBucketMap = exports.createErrorType('MissingBucketMap');
|
|
83
|
+
exports.MissingBucketMap = (0, exports.createErrorType)('MissingBucketMap');
|
|
80
84
|
/**
|
|
81
85
|
* The provider info is missing error
|
|
82
86
|
*/
|
|
83
|
-
exports.ProviderNotFound = exports.createErrorType('ProviderNotFound');
|
|
84
|
-
exports.ConnectionTimeout = exports.createErrorType('ConnectionTimeout');
|
|
85
|
-
exports.CumulusMessageError = exports.createErrorType('CumulusMessageError');
|
|
86
|
-
exports.DeletePublishedGranule = exports.createErrorType('DeletePublishedGranule');
|
|
87
|
-
exports.DuplicateFile = exports.createErrorType('DuplicateFile');
|
|
88
|
-
exports.EcsStartTaskError = exports.createErrorType('EcsStartTaskError');
|
|
89
|
-
exports.FileNotFound = exports.createErrorType('FileNotFound');
|
|
90
|
-
exports.FTPError = exports.createErrorType('FTPError');
|
|
91
|
-
exports.ApiCollisionError = exports.createErrorType('ApiCollisionError');
|
|
92
|
-
exports.HostNotFound = exports.createErrorType('HostNotFound');
|
|
93
|
-
exports.InvalidArgument = exports.createErrorType('InvalidArgument');
|
|
94
|
-
exports.InvalidChecksum = exports.createErrorType('InvalidChecksum');
|
|
95
|
-
exports.InvalidRegexError = exports.createErrorType('InvalidRegexError');
|
|
96
|
-
exports.MismatchPdrCollection = exports.createErrorType('MismatchPdrCollection');
|
|
97
|
-
exports.MissingRequiredEnvVar = exports.createErrorType('MissingRequiredEnvVar');
|
|
98
|
-
exports.PDRParsingError = exports.createErrorType('PDRParsingError');
|
|
99
|
-
exports.RecordDoesNotExist = exports.createErrorType('RecordDoesNotExist');
|
|
100
|
-
exports.UnexpectedFileSize = exports.createErrorType('UnexpectedFileSize');
|
|
101
|
-
exports.UnmatchedRegexError = exports.createErrorType('UnmatchedRegexError');
|
|
102
|
-
exports.UnparsableFileLocationError = exports.createErrorType('UnparsableFileLocationError');
|
|
103
|
-
exports.ValidationError = exports.createErrorType('ValidationError');
|
|
104
|
-
exports.MissingRequiredEnvVarError = exports.createErrorType('MissingRequiredEnvVarError');
|
|
105
|
-
exports.RecordAlreadyMigrated = exports.createErrorType('RecordAlreadyMigrated');
|
|
106
|
-
exports.GranuleNotPublished = exports.createErrorType('GranuleNotPublished');
|
|
87
|
+
exports.ProviderNotFound = (0, exports.createErrorType)('ProviderNotFound');
|
|
88
|
+
exports.ConnectionTimeout = (0, exports.createErrorType)('ConnectionTimeout');
|
|
89
|
+
exports.CumulusMessageError = (0, exports.createErrorType)('CumulusMessageError');
|
|
90
|
+
exports.DeletePublishedGranule = (0, exports.createErrorType)('DeletePublishedGranule');
|
|
91
|
+
exports.DuplicateFile = (0, exports.createErrorType)('DuplicateFile');
|
|
92
|
+
exports.EcsStartTaskError = (0, exports.createErrorType)('EcsStartTaskError');
|
|
93
|
+
exports.FileNotFound = (0, exports.createErrorType)('FileNotFound');
|
|
94
|
+
exports.FTPError = (0, exports.createErrorType)('FTPError');
|
|
95
|
+
exports.ApiCollisionError = (0, exports.createErrorType)('ApiCollisionError');
|
|
96
|
+
exports.HostNotFound = (0, exports.createErrorType)('HostNotFound');
|
|
97
|
+
exports.InvalidArgument = (0, exports.createErrorType)('InvalidArgument');
|
|
98
|
+
exports.InvalidChecksum = (0, exports.createErrorType)('InvalidChecksum');
|
|
99
|
+
exports.InvalidRegexError = (0, exports.createErrorType)('InvalidRegexError');
|
|
100
|
+
exports.MismatchPdrCollection = (0, exports.createErrorType)('MismatchPdrCollection');
|
|
101
|
+
exports.MissingRequiredEnvVar = (0, exports.createErrorType)('MissingRequiredEnvVar');
|
|
102
|
+
exports.PDRParsingError = (0, exports.createErrorType)('PDRParsingError');
|
|
103
|
+
exports.RecordDoesNotExist = (0, exports.createErrorType)('RecordDoesNotExist');
|
|
104
|
+
exports.UnexpectedFileSize = (0, exports.createErrorType)('UnexpectedFileSize');
|
|
105
|
+
exports.UnmatchedRegexError = (0, exports.createErrorType)('UnmatchedRegexError');
|
|
106
|
+
exports.UnparsableFileLocationError = (0, exports.createErrorType)('UnparsableFileLocationError');
|
|
107
|
+
exports.ValidationError = (0, exports.createErrorType)('ValidationError');
|
|
108
|
+
exports.MissingRequiredEnvVarError = (0, exports.createErrorType)('MissingRequiredEnvVarError');
|
|
109
|
+
exports.RecordAlreadyMigrated = (0, exports.createErrorType)('RecordAlreadyMigrated');
|
|
110
|
+
exports.GranuleNotPublished = (0, exports.createErrorType)('GranuleNotPublished');
|
|
107
111
|
class PostgresValidationError extends exports.ValidationError {
|
|
108
112
|
constructor(message) {
|
|
109
113
|
super(message);
|
|
@@ -112,6 +116,6 @@ class PostgresValidationError extends exports.ValidationError {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
exports.PostgresValidationError = PostgresValidationError;
|
|
115
|
-
exports.PostgresUpdateFailed = exports.createErrorType('PostgresUpdateFailed');
|
|
116
|
-
exports.IndexExistsError = exports.createErrorType('IndexExistsError');
|
|
119
|
+
exports.PostgresUpdateFailed = (0, exports.createErrorType)('PostgresUpdateFailed');
|
|
120
|
+
exports.IndexExistsError = (0, exports.createErrorType)('IndexExistsError');
|
|
117
121
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/errors",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.9.1",
|
|
4
4
|
"description": "Provides error classes for Cumulus",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
},
|
|
33
33
|
"author": "Cumulus Authors",
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "7a6a8ce08bf67e5174c1523b4af2e00e1a3c58cc"
|
|
36
36
|
}
|