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 1
1
import { Dialog , Notification , showErrorMessage } from '@jupyterlab/apputils' ;
2
2
import { TranslationBundle } from '@jupyterlab/translation' ;
3
+ import React from 'react' ;
3
4
4
5
/**
5
6
* Build notification options to display in a dialog the detailed error.
@@ -18,9 +19,26 @@ export function showError(
18
19
{
19
20
label : trans . __ ( 'Show' ) ,
20
21
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
+ ) ;
24
42
} ,
25
43
displayType : 'warn'
26
44
} as Notification . IAction
You can’t perform that action at this time.
0 commit comments