Skip to content

Commit 8985428

Browse files
committed
update metadata API to support handling errors
1 parent b685523 commit 8985428

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

packages/salesforce/src/connection/metadata/metadataApi.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,16 @@ export class MetadataApi implements DeploymentApi {
5151

5252
private invoke<K extends keyof MetadataResponses>(method: K, message: object, responsePath?: string) : Promise<MetadataResponses[K]>;
5353
private async invoke<T>(method: string, message: object, responsePath?: string) : Promise<T> {
54-
const response = await this.soap.request(method, message, {
55-
requestSchema: Operations[method]?.request,
56-
responseSchema: Operations[method]?.response
57-
});
58-
return (responsePath ? getObjectProperty(response.body, responsePath) : response.body) as T;
54+
try {
55+
const response = await this.soap.request(method, message, {
56+
requestSchema: Operations[method]?.request,
57+
responseSchema: Operations[method]?.response
58+
});
59+
return (responsePath ? getObjectProperty(response.body, responsePath) : response.body) as T;
60+
} catch(err) {
61+
this.connection.emit('error', err);
62+
throw err;
63+
}
5964
}
6065

6166
private convertArray<T>(value: T | T[], asArray: true): T[];

0 commit comments

Comments
 (0)