@evervault/sdk
Advanced tools
Comparing version 1.9.0 to 1.9.1
@@ -20,4 +20,19 @@ class EvervaultError extends Error { | ||
const mapApiResponseToError = ({ statusCode, body }) => { | ||
class ForbiddenIPError extends EvervaultError {} | ||
class DecryptError extends EvervaultError {} | ||
const mapApiResponseToError = ({ statusCode, body, headers }) => { | ||
if (statusCode === 401) return new ApiKeyError('Invalid Api Key provided.'); | ||
if ( | ||
statusCode === 403 && | ||
headers['x-evervault-error-code'] === 'forbidden-ip-error' | ||
) { | ||
return new ForbiddenIPError( | ||
body.message || "IP is not present on the invoked Cage's whitelist." | ||
); | ||
} | ||
if (statusCode === 422) { | ||
return new DecryptError(body.message || 'Unable to decrypt data.'); | ||
} | ||
if (statusCode === 423) | ||
@@ -45,2 +60,4 @@ return new AccountError( | ||
CertError, | ||
DecryptError, | ||
ForbiddenIPError, | ||
}; |
{ | ||
"name": "@evervault/sdk", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"description": "Node.js SDK for Evervault", | ||
@@ -64,3 +64,3 @@ "main": "lib/index.js", | ||
"lint-staged": { | ||
"**/*": "prettier --write --ignore-unknown ." | ||
"**/*.js": "prettier --write --ignore-unknown \"./**/*.js\"" | ||
}, | ||
@@ -67,0 +67,0 @@ "config": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41021
1095