Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/aio-lib-core-errors

Package Overview
Dependencies
Maintainers
48
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/aio-lib-core-errors - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

jsconfig.json

46

doc/api.md

@@ -1,10 +0,1 @@

## Modules
<dl>
<dt><a href="#module_AioCoreSDKError">AioCoreSDKError</a></dt>
<dd></dd>
<dt><a href="#module_AioCoreSDKErrorWrapper">AioCoreSDKErrorWrapper</a></dt>
<dd></dd>
</dl>
## Classes

@@ -21,3 +12,3 @@

<dl>
<dt><a href="#ErrorWrapper">ErrorWrapper(errorClassName, sdkName, Updater, BaseClass)</a></dt>
<dt><a href="#ErrorWrapper">ErrorWrapper(errorClassName, sdkName, updater, baseClass)</a></dt>
<dd><p>Returns a function that will dynamically create a class with the

@@ -31,3 +22,8 @@ error code specified, and updates the objects specified via the Updater parameter.</p>

</dd>
<dt><a href="#createUpdater">createUpdater(codes, messages)</a></dt>
</dl>
## Typedefs
<dl>
<dt><a href="#createUpdater">createUpdater</a> : <code>function</code></dt>
<dd><p>Returns a function that updates the parameters specified.

@@ -38,8 +34,2 @@ This is used in ErrorWrapper.</p>

<a name="module_AioCoreSDKError"></a>
## AioCoreSDKError
<a name="module_AioCoreSDKErrorWrapper"></a>
## AioCoreSDKErrorWrapper
<a name="AioCoreSDKError"></a>

@@ -54,3 +44,3 @@

* [new AioCoreSDKError([message], [code], [sdk], [sdkDetails], [captureStackTrace])](#new_AioCoreSDKError_new)
* [.toJSON()](#AioCoreSDKError+toJSON)
* [.toJSON()](#AioCoreSDKError+toJSON) ⇒ <code>Object</code>

@@ -74,3 +64,3 @@ <a name="new_AioCoreSDKError_new"></a>

### aioCoreSDKError.toJSON()
### aioCoreSDKError.toJSON() ⇒ <code>Object</code>
Returns a JSON respresentation of this Error object.

@@ -81,3 +71,3 @@

## ErrorWrapper(errorClassName, sdkName, Updater, BaseClass)
## ErrorWrapper(errorClassName, sdkName, updater, baseClass)
Returns a function that will dynamically create a class with the

@@ -96,17 +86,17 @@ error code specified, and updates the objects specified via the Updater parameter.

| sdkName | <code>string</code> | The name of your SDK. This will be a property in your Error objects |
| Updater | <code>function</code> | the object returned from a CreateUpdater call |
| BaseClass | <code>Class</code> | the base class that your Error class is extending. AioCoreSDKError is the default |
| updater | [<code>createUpdater</code>](#createUpdater) | the object returned from a createUpdater call |
| baseClass | <code>Error</code> | the base class that your Error class is extending. AioCoreSDKError is the default |
<a name="createUpdater"></a>
## createUpdater(codes, messages)
## createUpdater : <code>function</code>
Returns a function that updates the parameters specified.
This is used in ErrorWrapper.
**Kind**: global function
**Kind**: global typedef
| Param | Type |
| --- | --- |
| codes | <code>object</code> |
| messages | <code>Map</code> |
| Param | Type | Description |
| --- | --- | --- |
| codes | <code>Object.&lt;string, Error&gt;</code> | an object that will map an error code to an Error class. |
| messages | <code>Map.&lt;string, string&gt;</code> | a Map, that will map the error code to an error message |
{
"name": "@adobe/aio-lib-core-errors",
"version": "3.0.0",
"version": "3.0.1",
"description": "Adobe I/O SDK Core Errors",

@@ -9,3 +9,5 @@ "main": "src/index.js",

"lint": "eslint .",
"docs": "jsdoc2md -f 'src/*.js' > doc/api.md"
"jsdoc": "jsdoc2md -f 'src/*.js' > doc/api.md",
"typings": "jsdoc -t node_modules/tsd-jsdoc/dist -r src -d .",
"generate-docs": "npm run jsdoc && npm run typings"
},

@@ -23,9 +25,10 @@ "repository": {

"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.15.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-jest": "^23.0.2",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^24.9.0",
"jsdoc-to-markdown": "^5.0.1"
"jsdoc-to-markdown": "^5.0.1",
"tsd-jsdoc": "^2.4.0"
}
}

@@ -24,2 +24,6 @@ <!--

## Install
`npm install @adobe/aio-lib-core-errors`
## Architecture

@@ -277,8 +281,4 @@

{
"sdk": {
"name": "MySDK",
"details": {
"tenantId": "MYTENANT2"
}
},
"sdk": "MySDK",
"sdkDetails": { "tenantId": "MYTENANT2" },
"code": "UNKNOWN_ORDER_ID",

@@ -285,0 +285,0 @@ "message": "[MySDK:UNKNOWN_ORDER_ID] There was a problem with that order id: ORDER-21241-FSFS.",

@@ -48,2 +48,4 @@ /*

* Returns a JSON respresentation of this Error object.
*
* @return {Object}
*/

@@ -60,5 +62,3 @@ toJSON () {

}
/**
* @module AioCoreSDKError
*/
module.exports = AioCoreSDKError

@@ -41,2 +41,17 @@ /*

/**
* Returns a function that updates the parameters specified.
* This is used in ErrorWrapper.
*
* @callback createUpdater
* @param {Object<string, Error>} codes an object that will map an error code to an Error class.
* @param {Map<string, string>} messages a Map, that will map the error code to an error message
*/
function createUpdater (codes, messages) {
return function (code, message, clazz) {
messages.set(code, message)
codes[code] = clazz
}
}
/**
* Returns a function that will dynamically create a class with the

@@ -51,30 +66,13 @@ * error code specified, and updates the objects specified via the Updater parameter.

* @param {string} sdkName The name of your SDK. This will be a property in your Error objects
* @param {function} Updater the object returned from a CreateUpdater call
* @param {Class} BaseClass the base class that your Error class is extending. AioCoreSDKError is the default
* @param {createUpdater} updater the object returned from a createUpdater call
* @param {Error} baseClass the base class that your Error class is extending. AioCoreSDKError is the default
*/
function ErrorWrapper (errorClassName, sdkName, Updater, BaseClass = AioCoreSDKError) {
function ErrorWrapper (errorClassName, sdkName, updater, baseClass = AioCoreSDKError) {
return function (code, message) {
const createClass = curryCreateClass(errorClassName, sdkName, message, BaseClass)
const createClass = curryCreateClass(errorClassName, sdkName, message, baseClass)
const clazz = createClass(code)
Updater(code, message, clazz)
updater(code, message, clazz)
}
}
/**
* Returns a function that updates the parameters specified.
* This is used in ErrorWrapper.
*
* @param {object} codes
* @param {Map} messages
*/
function createUpdater (codes, messages) {
return function (code, message, clazz) {
messages.set(code, message)
codes[code] = clazz
}
}
/**
* @module AioCoreSDKErrorWrapper
*/
module.exports = {

@@ -81,0 +79,0 @@ ErrorWrapper,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc