@bedrock/kms-http 14.0.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/lib/middleware.js +6 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/middleware.js
CHANGED
|
@@ -152,27 +152,25 @@ async function inspectCapabilityChain({
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
function onError({error}) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
cause = error;
|
|
159
|
-
} else {
|
|
155
|
+
if(!(error instanceof BedrockError)) {
|
|
156
|
+
// always expose cause message and name; expose cause details as
|
|
157
|
+
// BedrockError if error is marked public
|
|
160
158
|
let details = {};
|
|
161
159
|
if(error.details && error.details.public) {
|
|
162
160
|
details = error.details;
|
|
163
161
|
}
|
|
164
|
-
|
|
162
|
+
error = new BedrockError(
|
|
165
163
|
error.message,
|
|
166
164
|
error.name || 'NotAllowedError', {
|
|
167
165
|
...details,
|
|
168
166
|
public: true,
|
|
169
|
-
});
|
|
167
|
+
}, error);
|
|
170
168
|
}
|
|
171
169
|
throw new BedrockError(
|
|
172
170
|
'Authorization error.', 'NotAllowedError', {
|
|
173
171
|
httpStatusCode: 403,
|
|
174
172
|
public: true,
|
|
175
|
-
},
|
|
173
|
+
}, error);
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
// hook used to create suites for verifying zcap delegation chains
|