@bedrock/vc-delivery 5.3.1 → 5.3.2

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.
Files changed (2) hide show
  1. package/lib/helpers.js +13 -2
  2. package/package.json +1 -1
package/lib/helpers.js CHANGED
@@ -13,6 +13,11 @@ import {ZcapClient} from '@digitalbazaar/ezcap';
13
13
 
14
14
  const {config, util: {BedrockError}} = bedrock;
15
15
 
16
+ const ALLOWED_ERROR_KEYS = [
17
+ 'message', 'name', 'type', 'data', 'errors', 'error', 'details', 'cause',
18
+ 'status'
19
+ ];
20
+
16
21
  export async function evaluateTemplate({
17
22
  workflow, exchange, typedTemplate
18
23
  } = {}) {
@@ -106,8 +111,14 @@ export function decodeLocalId({localId} = {}) {
106
111
  }
107
112
 
108
113
  export function stripStacktrace(error) {
109
- error = serializeError(error);
110
- delete error.stack;
114
+ // serialize error and allow-list specific properties
115
+ const serialized = serializeError(error);
116
+ error = {};
117
+ for(const key of ALLOWED_ERROR_KEYS) {
118
+ if(serialized[key] !== undefined) {
119
+ error[key] = serialized[key];
120
+ }
121
+ }
111
122
  if(error.errors) {
112
123
  error.errors = error.errors.map(stripStacktrace);
113
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-delivery",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "type": "module",
5
5
  "description": "Bedrock Verifiable Credential Delivery",
6
6
  "main": "./lib/index.js",