Skip to content

Commit

Permalink
Merge pull request RocketChat#824 from Shailesh351/sb_log_apps_endpoint
Browse files Browse the repository at this point in the history
Add Error Log Points for Apps Endpoint Failure
  • Loading branch information
ear-dev authored Jul 13, 2021
2 parents d121dd2 + b3eb5b3 commit 710c5de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/apps/server/bridges/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ export class AppApisBridge {
res.set(headers);
res.status(status);
res.send(content);
if (status !== 200) {
this.orch.errorLog(`The endpoint /${ endpoint.path } of the App ${ appId } failed. \n${ JSON.stringify(request) }\nStatus Code: ${ status } Response: ${ JSON.stringify(content) }`);
}
})
.catch((reason) => {
this.orch.errorLog(reason);
// Should we handle this as an error?
res.status(500).send(reason.message);
});
Expand Down
6 changes: 6 additions & 0 deletions app/apps/server/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ export class AppServerOrchestrator {
}
}

errorLog(...args) {
if (this.isDebugging()) {
this.getRocketChatLogger().error(...args);
}
}

getMarketplaceUrl() {
return this._marketplaceUrl;
}
Expand Down

0 comments on commit 710c5de

Please sign in to comment.