@salesforce/packaging 5.0.3 → 5.0.5
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.
|
@@ -30,9 +30,7 @@ export declare function uniqid(options?: {
|
|
|
30
30
|
}): string;
|
|
31
31
|
export declare function validateId(idObj: Many<IdRegistryValue>, value: string | undefined): void;
|
|
32
32
|
export declare function validateIdNoThrow(idObj: Many<IdRegistryValue>, value: string): IdRegistryValue | boolean;
|
|
33
|
-
export declare function applyErrorAction(err: Error
|
|
34
|
-
action?: string;
|
|
35
|
-
}): Error;
|
|
33
|
+
export declare function applyErrorAction(err: Error | SfError): Error;
|
|
36
34
|
export declare function massageErrorMessage(err: Error): Error;
|
|
37
35
|
/**
|
|
38
36
|
* Given a subscriber package version ID (04t) or package version ID (05i), return the package version ID (05i)
|
|
@@ -150,11 +150,10 @@ function validateIdNoThrow(idObj, value) {
|
|
|
150
150
|
// applies actions to common package errors
|
|
151
151
|
// eslint-disable-next-line complexity
|
|
152
152
|
function applyErrorAction(err) {
|
|
153
|
-
// append when actions already exist
|
|
154
153
|
const actions = [];
|
|
155
154
|
// include existing actions
|
|
156
|
-
if (err.
|
|
157
|
-
actions.push(err.
|
|
155
|
+
if (err instanceof core_1.SfError && err.actions?.length) {
|
|
156
|
+
actions.push(...err.actions);
|
|
158
157
|
}
|
|
159
158
|
// TODO: (need to get with packaging team on this)
|
|
160
159
|
// until next generation packaging is GA, wrap perm-based errors w/
|
|
@@ -186,7 +185,12 @@ function applyErrorAction(err) {
|
|
|
186
185
|
actions.push(messages.getMessage('idNotFoundAction'));
|
|
187
186
|
}
|
|
188
187
|
if (actions.length > 0) {
|
|
189
|
-
err
|
|
188
|
+
if (err instanceof core_1.SfError) {
|
|
189
|
+
err.actions = actions;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
err.actions = actions;
|
|
193
|
+
}
|
|
190
194
|
}
|
|
191
195
|
return err;
|
|
192
196
|
}
|