-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.js
More file actions
47 lines (41 loc) · 1.75 KB
/
Copy patherrors.js
File metadata and controls
47 lines (41 loc) · 1.75 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
/*
Copyright 2025 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
const { AioCoreSDKErrorWrapper } = require('@adobe/aio-lib-core-errors')
const { ErrorWrapper, createUpdater } = AioCoreSDKErrorWrapper
const codes = {}
const messages = new Map()
/**
* Create an Updater for the Error wrapper
*/
const Updater = createUpdater(
// object that stores the error classes (to be exported)
codes,
// Map that stores the error strings (to be exported)
messages
)
/**
* Provides a wrapper to easily create classes of a certain name, and values
*/
const E = ErrorWrapper(
// The class name for your SDK Error. Your Error objects will be these objects
'AuthSDKError',
// The name of your SDK. This will be a property in your Error objects
'AuthSDK',
// the object returned from the CreateUpdater call above
Updater
)
// Error codes
E('IMS_TOKEN_ERROR', 'Error calling IMS to get access token: %s')
E('MISSING_PARAMETERS', 'Missing required parameters: %s. You may want to set the include-ims-credentials annotation.')
E('BAD_CREDENTIALS_FORMAT', 'Credentials must be either an object or a stringified object')
E('BAD_SCOPES_FORMAT', 'Scopes must be an array')
E('GENERIC_ERROR', 'An unexpected error occurred: %s')
module.exports = { codes, messages }