Skip to content

Commit be0ede3

Browse files
authored
Merge pull request #8 from codemagic-ci-cd/normalize-standalone-error-name
Normalize legacy standalone error messages
2 parents 0344450 + 00e3cc1 commit be0ede3

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

script/management-sdk.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ interface PackageFile {
4040
path: string;
4141
}
4242

43+
function normalizeServerErrorMessage(message: string): string {
44+
return message ? message.replace(/code-push-standalone/g, "code-push") : message;
45+
}
46+
4347
// A template string tag function that URL encodes the substituted values
4448
function urlEncode(strings: string[], ...values: string[]): string {
4549
let result = "";
@@ -526,12 +530,12 @@ class AccountManager {
526530
} else {
527531
if (body) {
528532
reject(<CodePushError>{
529-
message: body.message,
533+
message: normalizeServerErrorMessage(body.message),
530534
statusCode: this.getErrorStatus(err, res),
531535
});
532536
} else {
533537
reject(<CodePushError>{
534-
message: res.text,
538+
message: normalizeServerErrorMessage(res.text),
535539
statusCode: this.getErrorStatus(err, res),
536540
});
537541
}
@@ -556,7 +560,7 @@ class AccountManager {
556560
}
557561

558562
private getErrorMessage(error: Error, response: superagent.Response): string {
559-
return response && response.text ? response.text : error.message;
563+
return normalizeServerErrorMessage(response && response.text ? response.text : error.message);
560564
}
561565

562566
private attachCredentials(request: superagent.Request<any>): void {

0 commit comments

Comments
 (0)