@cumulus/errors 9.7.1 → 10.0.0
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.d.ts +7 -0
- package/dist/index.js +45 -40
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -232,6 +232,13 @@ export declare const MismatchPdrCollection: {
|
|
|
232
232
|
stack?: string | undefined;
|
|
233
233
|
};
|
|
234
234
|
};
|
|
235
|
+
export declare const MissingRequiredArgument: {
|
|
236
|
+
new (message: string): {
|
|
237
|
+
name: string;
|
|
238
|
+
message: string;
|
|
239
|
+
stack?: string | undefined;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
235
242
|
export declare const MissingRequiredEnvVar: {
|
|
236
243
|
new (message: string): {
|
|
237
244
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexExistsError = exports.PostgresUpdateFailed = exports.PostgresValidationError = exports.GranuleNotPublished = exports.RecordAlreadyMigrated = exports.MissingRequiredEnvVarError = exports.ValidationError = exports.UnparsableFileLocationError = exports.UnmatchedRegexError = exports.UnexpectedFileSize = exports.RecordDoesNotExist = exports.PDRParsingError = exports.MissingRequiredEnvVar = exports.MismatchPdrCollection = exports.InvalidRegexError = exports.InvalidChecksum = exports.InvalidArgument = exports.HostNotFound = exports.ApiCollisionError = exports.FTPError = exports.FileNotFound = exports.EcsStartTaskError = exports.DuplicateFile = exports.DeletePublishedGranule = exports.CumulusMessageError = exports.ConnectionTimeout = exports.ProviderNotFound = exports.MissingBucketMap = exports.CMRInternalError = exports.CMRMetaFileNotFound = exports.XmlMetaFileNotFound = exports.RemoteResourceError = exports.ResourcesLockedError = exports.IncompleteError = exports.NotNeededError = exports.WorkflowError = exports.isConditionalCheckException = exports.isWorkflowError = exports.isThrottlingException = exports.ThrottlingException = exports.createErrorType = void 0;
|
|
3
|
+
exports.IndexExistsError = exports.PostgresUpdateFailed = exports.PostgresValidationError = exports.GranuleNotPublished = exports.RecordAlreadyMigrated = exports.MissingRequiredEnvVarError = exports.ValidationError = exports.UnparsableFileLocationError = exports.UnmatchedRegexError = exports.UnexpectedFileSize = exports.RecordDoesNotExist = exports.PDRParsingError = exports.MissingRequiredEnvVar = exports.MissingRequiredArgument = exports.MismatchPdrCollection = exports.InvalidRegexError = exports.InvalidChecksum = exports.InvalidArgument = exports.HostNotFound = exports.ApiCollisionError = exports.FTPError = exports.FileNotFound = exports.EcsStartTaskError = exports.DuplicateFile = exports.DeletePublishedGranule = exports.CumulusMessageError = exports.ConnectionTimeout = exports.ProviderNotFound = exports.MissingBucketMap = exports.CMRInternalError = exports.CMRMetaFileNotFound = exports.XmlMetaFileNotFound = exports.RemoteResourceError = exports.ResourcesLockedError = exports.IncompleteError = exports.NotNeededError = exports.WorkflowError = exports.isConditionalCheckException = exports.isWorkflowError = exports.isThrottlingException = exports.ThrottlingException = exports.createErrorType = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new error type with the given name and parent class. Sets up
|
|
6
6
|
* boilerplate necessary to successfully subclass Error and preserve stack trace
|
|
@@ -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,87 @@ 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.
|
|
98
|
-
exports.
|
|
99
|
-
exports.
|
|
100
|
-
exports.
|
|
101
|
-
exports.
|
|
102
|
-
exports.
|
|
103
|
-
exports.
|
|
104
|
-
exports.
|
|
105
|
-
exports.
|
|
106
|
-
exports.
|
|
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.MissingRequiredArgument = (0, exports.createErrorType)('MissingRequiredArgument');
|
|
102
|
+
exports.MissingRequiredEnvVar = (0, exports.createErrorType)('MissingRequiredEnvVar');
|
|
103
|
+
exports.PDRParsingError = (0, exports.createErrorType)('PDRParsingError');
|
|
104
|
+
exports.RecordDoesNotExist = (0, exports.createErrorType)('RecordDoesNotExist');
|
|
105
|
+
exports.UnexpectedFileSize = (0, exports.createErrorType)('UnexpectedFileSize');
|
|
106
|
+
exports.UnmatchedRegexError = (0, exports.createErrorType)('UnmatchedRegexError');
|
|
107
|
+
exports.UnparsableFileLocationError = (0, exports.createErrorType)('UnparsableFileLocationError');
|
|
108
|
+
exports.ValidationError = (0, exports.createErrorType)('ValidationError');
|
|
109
|
+
exports.MissingRequiredEnvVarError = (0, exports.createErrorType)('MissingRequiredEnvVarError');
|
|
110
|
+
exports.RecordAlreadyMigrated = (0, exports.createErrorType)('RecordAlreadyMigrated');
|
|
111
|
+
exports.GranuleNotPublished = (0, exports.createErrorType)('GranuleNotPublished');
|
|
107
112
|
class PostgresValidationError extends exports.ValidationError {
|
|
108
113
|
constructor(message) {
|
|
109
114
|
super(message);
|
|
@@ -112,6 +117,6 @@ class PostgresValidationError extends exports.ValidationError {
|
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
exports.PostgresValidationError = PostgresValidationError;
|
|
115
|
-
exports.PostgresUpdateFailed = exports.createErrorType('PostgresUpdateFailed');
|
|
116
|
-
exports.IndexExistsError = exports.createErrorType('IndexExistsError');
|
|
120
|
+
exports.PostgresUpdateFailed = (0, exports.createErrorType)('PostgresUpdateFailed');
|
|
121
|
+
exports.IndexExistsError = (0, exports.createErrorType)('IndexExistsError');
|
|
117
122
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/errors",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
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": "7c6d2d1cd79b57d6943bbc3d898d0cf975b543b1"
|
|
36
36
|
}
|