Skip to content

Commit 6467476

Browse files
committed
Really do avoid reporting [object Object]
_Especially_ in the error code path. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f9e787a commit 6467476

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

GitForWindowsHelper/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = async function (context, req) {
3333
&& req.body.comment.body.startsWith('/')) return ok(await slashCommand(context, req))
3434
} catch (e) {
3535
context.log(e)
36-
return withStatus(500, undefined, e.toString('utf-8'))
36+
return withStatus(500, undefined, e.message || JSON.stringify(e, null, 2))
3737
}
3838

3939
try {
@@ -46,7 +46,7 @@ module.exports = async function (context, req) {
4646
&& req.body.workflow_job.labels[1] === 'ARM64') return ok(await selfHostedARM64Runners(context, req))
4747
} catch (e) {
4848
context.log(e)
49-
return withStatus(500, undefined, e.toString('utf-8'))
49+
return withStatus(500, undefined, e.message || JSON.stringify(e, null, 2))
5050
}
5151

5252
try {
@@ -56,7 +56,7 @@ module.exports = async function (context, req) {
5656
&& req.body.action === 'completed') return ok(await cascadingRuns(context, req))
5757
} catch (e) {
5858
context.log(e)
59-
return withStatus(500, undefined, e.toString('utf-8'))
59+
return withStatus(500, undefined, e.message || JSON.stringify(e, null, 2))
6060
}
6161

6262
context.log("Got headers")

GitForWindowsHelper/slash-commands.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ module.exports = async (context, req) => {
347347
status: 'completed',
348348
conclusion: 'failure',
349349
output: {
350-
text: e.toString()
350+
text: e.message || JSON.stringify(e, null, 2)
351351
}
352352
}
353353
)
@@ -455,7 +455,7 @@ module.exports = async (context, req) => {
455455
status: 'completed',
456456
conclusion: 'failure',
457457
output: {
458-
text: e.toString()
458+
text: e.message || JSON.stringify(e, null, 2)
459459
}
460460
}
461461
)

0 commit comments

Comments
 (0)