File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 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 {
227227 }
228228}
229229
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+
230238pub fn handle_status_page ( data : & InputData ) -> status:: Response {
231239 let last_commit = data. data ( Interpolate :: No ) . iter ( ) . next_back ( ) . unwrap ( ) ;
232240
@@ -235,12 +243,7 @@ pub fn handle_status_page(data: &InputData) -> status::Response {
235243 . iter ( )
236244 . map ( |( name, res) | {
237245 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 ( ) ) )
244247 } else {
245248 None
246249 } ;
You can’t perform that action at this time.
0 commit comments