File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 11import { Dialog , Notification , showErrorMessage } from '@jupyterlab/apputils' ;
22import { TranslationBundle } from '@jupyterlab/translation' ;
3+ import * as React from 'react' ;
34
45/**
56 * Build notification options to display in a dialog the detailed error.
@@ -18,9 +19,20 @@ export function showError(
1819 {
1920 label : trans . __ ( 'Show' ) ,
2021 callback : ( ) => {
21- showErrorMessage ( trans . __ ( 'Error' ) , error , [
22- Dialog . warnButton ( { label : trans . __ ( 'Dismiss' ) } )
23- ] ) ;
22+ showErrorMessage (
23+ trans . __ ( 'Error' ) ,
24+ {
25+ // Render error in a <pre> element to preserve line breaks and
26+ // use a monospace font so e.g. pre-commit errors are readable.
27+ // Ref: https://github.com/jupyterlab/jupyterlab-git/issues/1407
28+ message : (
29+ < pre style = { { whiteSpace : 'pre-wrap' , fontSize : '7pt' } } >
30+ { error . message || error . stack || String ( error ) }
31+ </ pre >
32+ )
33+ } ,
34+ [ Dialog . warnButton ( { label : trans . __ ( 'Dismiss' ) } ) ]
35+ ) ;
2436 } ,
2537 displayType : 'warn'
2638 } as Notification . IAction
You can’t perform that action at this time.
0 commit comments