File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-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 React from 'react' ;
34
45/**
56 * Build notification options to display in a dialog the detailed error.
@@ -18,9 +19,26 @@ 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+ message : React . createElement (
26+ React . Fragment ,
27+ null ,
28+ React . createElement (
29+ // Render error in a <pre> element to preserve line breaks and
30+ // use a monospace font so e.g. pre-commit errors are readable.
31+ // Ref: https://github.com/jupyterlab/jupyterlab-git/issues/1407
32+ 'pre' ,
33+ { style : { whiteSpace : 'pre-wrap' , fontSize : '7pt' } } ,
34+ error . message || error . stack || String ( error )
35+ )
36+ )
37+ } ,
38+ [
39+ Dialog . warnButton ( { label : trans . __ ( 'Dismiss' ) } )
40+ ]
41+ ) ;
2442 } ,
2543 displayType : 'warn'
2644 } as Notification . IAction
You can’t perform that action at this time.
0 commit comments