File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 11use crate :: github:: { self , WorkflowRunJob } ;
22use crate :: handlers:: Context ;
3+ use crate :: interactions:: REPORT_TO ;
34use crate :: utils:: AppError ;
45use anyhow:: Context as _;
56use axum:: extract:: { Path , State } ;
@@ -272,6 +273,8 @@ body {{
272273 </style>
273274 <script type="module" nonce="{nonce}">
274275 import {{ AnsiUp }} from '{ANSI_UP_URL}'
276+
277+ try {{
275278
276279 const logs = {logs};
277280 const tree_roots = {tree_roots};
@@ -348,6 +351,11 @@ body {{
348351 inline: hasSmallViewport ? 'start' : 'center'
349352 }});
350353 }}
354+
355+ }} catch (e) {{
356+ console.error(e);
357+ document.body.innerText = `Something went wrong: ${{e}}\n\n{REPORT_TO}`;
358+ }}
351359 </script>
352360</head>
353361<body>
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ use crate::{
88} ;
99use std:: fmt:: Write ;
1010
11+ pub const REPORT_TO : & str = "Please file an issue on GitHub at [triagebot](https://github.com/rust-lang/triagebot) if there's \
12+ a problem with this bot, or reach out on [#triagebot](https://rust-lang.zulipchat.com/#narrow/channel/224082-triagebot) on Zulip.";
13+
1114pub struct ErrorComment < ' a > {
1215 issue : & ' a Issue ,
1316 message : String ,
@@ -28,11 +31,7 @@ impl<'a> ErrorComment<'a> {
2831 let mut body = String :: new ( ) ;
2932 writeln ! ( body, "**Error**: {message}" ) ?;
3033 writeln ! ( body) ?;
31- writeln ! (
32- body,
33- "Please file an issue on GitHub at [triagebot](https://github.com/rust-lang/triagebot) if there's \
34- a problem with this bot, or reach out on [#t-infra](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra) on Zulip."
35- ) ?;
34+ writeln ! ( body, "{REPORT_TO}" ) ?;
3635 Ok ( body)
3736 }
3837
Original file line number Diff line number Diff line change 1+ use crate :: interactions:: REPORT_TO ;
2+
13use axum:: {
24 http:: StatusCode ,
35 response:: { IntoResponse , Response } ,
@@ -20,7 +22,7 @@ impl IntoResponse for AppError {
2022 tracing:: error!( "{:?}" , & self . 0 ) ;
2123 (
2224 StatusCode :: INTERNAL_SERVER_ERROR ,
23- format ! ( "Something went wrong: {}" , self . 0 ) ,
25+ format ! ( "Something went wrong: {}\n \n {REPORT_TO} " , self . 0 ) ,
2426 )
2527 . into_response ( )
2628 }
You can’t perform that action at this time.
0 commit comments