File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ const WelcomeText = styled("span")(({ theme }) => ({
6464 fontWeight : "bold" ,
6565} ) ) ;
6666
67+ const decodeFormat = ( data ) => {
68+ return data ? atob ( data ) . split ( "\n" ) : [ ] ;
69+ }
70+
6771function EditorComponent ( ) {
6872 const [ code , setCode ] = useState ( null ) ;
6973 const [ output , setOutput ] = useState ( [ ] ) ;
@@ -192,12 +196,14 @@ function EditorComponent() {
192196 . then ( ( data ) => {
193197 if ( ! data . stdout ) {
194198 enqueueSnackbar ( "Please check the code" , { variant : "error" } ) ;
195- setOutput ( data . message ) ;
199+ if ( data . stderr ) {
200+ setOutput ( decodeFormat ( data . stderr ) ) ;
201+ } else if ( data . compile_output ) {
202+ setOutput ( decodeFormat ( data . compile_output ) ) ;
203+ }
196204 return ;
197205 }
198- const decodedOutput = atob ( data . stdout ) ;
199- const formattedData = decodedOutput . split ( "\n" ) ;
200- setOutput ( formattedData ) ;
206+ setOutput ( decodeFormat ( data . stdout ) ) ;
201207 } )
202208 . catch ( ( error ) => {
203209 enqueueSnackbar ( "Error retrieving output: " + error . message , {
You can’t perform that action at this time.
0 commit comments