File tree Expand file tree Collapse file tree 5 files changed +25
-13
lines changed Expand file tree Collapse file tree 5 files changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -310,7 +310,7 @@ class Channel implements Channel {
310310 case 'TEST_PASS' :
311311 const tutorial = this . context . tutorial . get ( )
312312 if ( ! tutorial ) {
313- throw new Error ( 'Error with current tutorial ' )
313+ throw new Error ( 'ERROR: Tutorial not found in test run ' )
314314 }
315315 // update local storage stepProgress
316316 const progress = this . context . progress . setStepComplete ( tutorial , action . payload . stepId )
@@ -321,7 +321,7 @@ class Channel implements Channel {
321321 // send message
322322 const sentToClient = await this . postMessage ( action )
323323 if ( ! sentToClient ) {
324- throw new Error ( `Message post failure: ${ JSON . stringify ( action ) } ` )
324+ throw new Error ( `ERROR: Message post failure: ${ JSON . stringify ( action ) } ` )
325325 }
326326 }
327327}
Original file line number Diff line number Diff line change 11import { LOG } from '../../environment'
22
3- const logger = ( message : string | string [ ] ) => {
3+ export type Log = string | object
4+
5+ const logger = ( ...messages : Log [ ] ) : void => {
46 if ( ! LOG ) {
57 return
68 }
7- if ( Array . isArray ( message ) ) {
8- message . forEach ( console . log )
9- } else {
10- console . log ( message )
9+ // Inside vscode, you console.log does not allow more than 1 param
10+ // to get around it, we can log with multiple log statements
11+ for ( const message of messages ) {
12+ if ( typeof message === 'object' ) {
13+ console . log ( JSON . stringify ( message ) )
14+ } else {
15+ console . log ( message )
16+ }
1117 }
1218}
1319
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class ErrorBoundary extends React.Component {
1010 // Display fallback UI
1111 this . setState ( { errorMessage : error . message } )
1212 // You can also log the error to an error reporting service
13- logger ( 'ERROR in component:' , JSON . stringify ( error ) )
14- logger ( 'ERROR info:' , JSON . stringify ( info ) )
13+ logger ( 'ERROR in component:' , error )
14+ logger ( 'ERROR info:' , info )
1515 }
1616
1717 public render ( ) {
Original file line number Diff line number Diff line change @@ -59,14 +59,14 @@ const useRouter = (): Output => {
5959 } else if ( Array . isArray ( path ) ) {
6060 pathMatch = path . some ( ( p ) => state . matches ( p ) )
6161 } else {
62- throw new Error ( `Invalid route path ${ JSON . stringify ( path ) } ` )
62+ throw new Error ( `ERROR: Invalid route path: ${ JSON . stringify ( path ) } ` )
6363 }
6464 if ( pathMatch ) {
6565 // @ts -ignore
6666 return child . props . children
6767 }
6868 }
69- const message = `No Route matches for ${ JSON . stringify ( state ) } `
69+ const message = `ERROR: No Route matches for ${ JSON . stringify ( state ) } `
7070 onError ( new Error ( message ) )
7171 console . warn ( message )
7272 return null
Original file line number Diff line number Diff line change 11import { LOG } from '../../environment'
22
3- const logger = ( ...messages : string [ ] ) => {
3+ export type Log = string | object
4+
5+ const logger = ( ...messages : Log [ ] ) : void => {
46 if ( ! LOG ) {
57 return
68 }
79 // Inside vscode, you console.log does not allow more than 1 param
810 // to get around it, we can log with multiple log statements
911 for ( const message of messages ) {
10- console . log ( message )
12+ if ( typeof message === 'object' ) {
13+ console . log ( JSON . stringify ( message ) )
14+ } else {
15+ console . log ( message )
16+ }
1117 }
1218}
1319
You can’t perform that action at this time.
0 commit comments