File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,14 @@ pub fn handle_dashboard(data: &InputData) -> dashboard::Response {
227
227
}
228
228
}
229
229
230
+ fn prettify_log ( log : & str ) -> Option < String > {
231
+ let mut lines = log. lines ( ) ;
232
+ let first = lines. next ( ) ?;
233
+ let log = & first[ first. find ( '"' ) ? + 1 ..] ;
234
+ let log = & log[ ..log. find ( "\" }" ) ?] ;
235
+ Some ( log. replace ( "\\ n" , "\n " ) )
236
+ }
237
+
230
238
pub fn handle_status_page ( data : & InputData ) -> status:: Response {
231
239
let last_commit = data. data ( Interpolate :: No ) . iter ( ) . next_back ( ) . unwrap ( ) ;
232
240
@@ -235,12 +243,7 @@ pub fn handle_status_page(data: &InputData) -> status::Response {
235
243
. iter ( )
236
244
. map ( |( name, res) | {
237
245
let msg = if let Some ( error) = res. as_ref ( ) . err ( ) {
238
- let mut lines = error. lines ( ) ;
239
- let first = lines. next ( ) . unwrap ( ) ;
240
- let log = & first[ first. find ( '"' ) . unwrap ( ) + 1 ..] ;
241
- let log = & log[ ..log. find ( "\" }" ) . unwrap ( ) ] ;
242
- let log = log. replace ( "\\ n" , "\n " ) ;
243
- Some ( log)
246
+ Some ( prettify_log ( error) . unwrap_or_else ( || error. to_owned ( ) ) )
244
247
} else {
245
248
None
246
249
} ;
You can’t perform that action at this time.
0 commit comments