File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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,15 @@ 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+ }
202+ else if ( data . compile_output ) {
203+ setOutput ( decodeFormat ( data . compile_output ) ) ;
204+ }
196205 return ;
197206 }
198- const decodedOutput = atob ( data . stdout ) ;
199- const formattedData = decodedOutput . split ( "\n" ) ;
200- setOutput ( formattedData ) ;
207+ setOutput ( decodeFormat ( data . stdout ) ) ;
201208 } )
202209 . catch ( ( error ) => {
203210 enqueueSnackbar ( "Error retrieving output: " + error . message , {
You can’t perform that action at this time.
0 commit comments