File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,17 @@ import { JSONRPCError } from "@open-rpc/client-js/build/Error";
10
10
import { MethodObject } from "@open-rpc/meta-schema" ;
11
11
import MonacoEditor from "@etclabscore/react-monaco-editor" ;
12
12
13
+ const errorToJSON = ( error : JSONRPCError | undefined ) : any => {
14
+ if ( ! error ) {
15
+ return ;
16
+ }
17
+ return {
18
+ code : error . code ,
19
+ message : error . message ,
20
+ data : error . data ,
21
+ } ;
22
+ } ;
23
+
13
24
interface IProps {
14
25
url ?: string ;
15
26
request ?: any ;
@@ -127,7 +138,6 @@ const Inspector: React.FC<IProps> = (props) => {
127
138
}
128
139
} ;
129
140
130
-
131
141
return (
132
142
< >
133
143
< AppBar elevation = { 0 } position = "static" >
@@ -200,7 +210,7 @@ const Inspector: React.FC<IProps> = (props) => {
200
210
height = "93vh"
201
211
editorDidMount = { handleResponseEditorDidMount }
202
212
language = "json"
203
- value = { JSON . stringify ( error || results , null , 4 ) || "" }
213
+ value = { JSON . stringify ( errorToJSON ( error ) || results , null , 4 ) || "" }
204
214
/>
205
215
</ >
206
216
</ SplitPane >
You can’t perform that action at this time.
0 commit comments