node-vault
Advanced tools
Comparing version 0.8.0 to 0.9.0
{ | ||
"name": "node-vault", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Javascript client for HashiCorp's Vault", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -9,2 +9,14 @@ 'use strict'; | ||
class VaultError extends Error {} | ||
class ApiResponseError extends VaultError { | ||
constructor(message, response) { | ||
super(message); | ||
this.response = { | ||
statusCode: response.statusCode, | ||
body: response.body, | ||
}; | ||
} | ||
} | ||
module.exports = (config = {}) => { | ||
@@ -25,3 +37,3 @@ // load conditional dependencies | ||
function handleVaultResponse(response) { | ||
if (!response) return Promise.reject(new Error('No response passed')); | ||
if (!response) return Promise.reject(new VaultError('No response passed')); | ||
debug(response.statusCode); | ||
@@ -39,3 +51,3 @@ if (response.statusCode !== 200 && response.statusCode !== 204) { | ||
} | ||
const error = new Error(message); | ||
const error = new ApiResponseError(message, response); | ||
return Promise.reject(error); | ||
@@ -42,0 +54,0 @@ } |
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
35968
1328