@nodearch/vault
Version:
NodeArch Vault Wrapper
19 lines • 571 B
JavaScript
export class VaultError extends Error {
constructor(vaultHttpError) {
super(vaultHttpError.data);
this.statusCode = vaultHttpError.status;
const matchResult = this.message.match(/({.*})/);
if (matchResult && matchResult.length) {
try {
this.errors = JSON.parse(matchResult[1]).errors;
}
catch (e) {
this.errors = [this.message];
}
}
else {
this.errors = [this.message];
}
}
}
//# sourceMappingURL=vault.error.js.map