Skip to content

Commit

Permalink
Stop/alter more logging (#1767)
Browse files Browse the repository at this point in the history
* Catch GH import routine
* Add `#bypass` to statusCodePage

Post #1731 , applies to #430 #37 and closes #1730

Auto-merge
  • Loading branch information
Martii committed Sep 25, 2020
1 parent 90f0b70 commit 132efb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1682,13 +1682,17 @@ exports.userGitHubImportScriptPage = function (aReq, aRes, aNext) {
},
], function (aErr) {
var script = null;
var code = null;

if (aErr) {
console.error([
aErr,
authedUser.name + ' ' + githubUserId + ' ' + githubRepoName + ' ' + githubBlobPath
code = (aErr instanceof statusError ? aErr.status.code : aErr.code);
if (code && !isNaN(code) && code >= 500) {
console.error([
aErr,
authedUser.name + ' ' + githubUserId + ' ' + githubRepoName + ' ' + githubBlobPath

].join('\n'));
].join('\n'));
}

if (!(aErr instanceof String)) {
statusCodePage(aReq, aRes, aNext, {
Expand All @@ -1707,7 +1711,7 @@ exports.userGitHubImportScriptPage = function (aReq, aRes, aNext) {
});
} else {
statusCodePage(aReq, aRes, aNext, {
statusCode: 500, // NOTE: Watchpoint
statusCode: 500,
statusMessage: aErr
});
}
Expand Down
2 changes: 1 addition & 1 deletion views/pages/statusCodePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h1 class="status-code text-center">{{statusCode}}</h1>
Session Length: <strong>{{length}}</strong>
{{/isAdminSessionLengthView}}
{{#isGHImport}}
{{{statusMessage}}}<br /><a href="https://github.com/{{user}}/{{repo}}/tree/{{default_branch}}/{{path}}"><b>{{utf_pathname}}</b>{{utf_pathext}}</a>
{{{statusMessage}}}<br /><a href="https://github.com/{{user}}/{{repo}}/tree/{{default_branch}}/{{path}}#bypass=true"><b>{{utf_pathname}}</b>{{utf_pathext}}</a>
{{/isGHImport}}
{{#isListView}}
{{{statusMessage}}}<br />Please retry {{#retryAfter}}after approximately {{retryAfter}} seconds{{/retryAfter}}{{^retryAfter}}later{{/retryAfter}}.
Expand Down

0 comments on commit 132efb6

Please sign in to comment.