Skip to content

Commit

Permalink
#1627: improve error handling for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Aug 29, 2024
1 parent 2fc57dc commit bc60650
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions lib/metadataTypes/Journey.js
Original file line number Diff line number Diff line change
Expand Up @@ -1702,18 +1702,33 @@ class Journey extends MetadataType {
executedKeyArr.push(await this._checkPublishStatus(statusUrl, key));
}
} catch (ex) {
if (ex.message === 'Cannot publish interaction in Published status.') {
Util.logger.info(
` - ${this.definition.type} ${key} is already published`
);
} else if (ex.message === 'Cannot publish interaction in Stopped status.') {
Util.logger.warn(
` - ${this.definition.type} ${key} is already published but stopped. Please resume it manually.`
);
} else {
Util.logger.error(
`Failed to publish ${this.definition.type} ${key}: ${ex.message}`
);
switch (ex.message) {
case 'Cannot publish interaction in Published status.': {
Util.logger.info(
` - ${this.definition.type} ${key}/${version} is already published.`
);

break;
}
case 'Cannot publish interaction in Stopped status.': {
Util.logger.warn(
` - ${this.definition.type} ${key}/${version} is stopped. Please create a new version and publish that.`
);

break;
}
case 'Cannot publish interaction in Paused status.': {
Util.logger.warn(
` - ${this.definition.type} ${key}/${version} is already published but currently paused. Run 'mcdev resume' instead.`
);

break;
}
default: {
Util.logger.error(
`Failed to publish ${this.definition.type} ${key}: ${ex.message}`
);
}
}
}
break;
Expand Down

0 comments on commit bc60650

Please sign in to comment.