File tree 2 files changed +22
-2
lines changed
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { initialValues } from '../constants';
10
10
import { useAppContext } from './Context' ;
11
11
import HtmlPreview from './HtmlPreview' ;
12
12
import state from '../lib/state' ;
13
+ import ErrorBox from './ErrorBox' ;
13
14
14
15
const savedState = state . load ( ) ;
15
16
@@ -60,11 +61,17 @@ function App() {
60
61
/>
61
62
< div className = "output" >
62
63
< span className = "text-blue-600" > > </ span >
63
- { parsed . text || parsed . error || 'undefined' }
64
+ { parsed . error
65
+ ? `Error: ${ parsed . error } `
66
+ : parsed . text || 'undefined' }
64
67
</ div >
65
68
</ div >
66
69
67
- < ElementInfo />
70
+ { parsed . error ? (
71
+ < ErrorBox caption = { parsed . error } body = { parsed . errorBody } />
72
+ ) : (
73
+ < ElementInfo />
74
+ ) }
68
75
</ div >
69
76
</ div >
70
77
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+
3
+ function ErrorBox ( { caption, body } ) {
4
+ return (
5
+ < div className = "bg-red-600 text-white p-4 rounded space-y-2 font-mono text-xs" >
6
+ < div className = "font-bold text-xs" > Error: { caption } </ div >
7
+
8
+ < div className = "font-mono text-xs whitespace-pre-wrap" > { body } </ div >
9
+ </ div >
10
+ ) ;
11
+ }
12
+
13
+ export default ErrorBox ;
You can’t perform that action at this time.
0 commit comments