File tree Expand file tree Collapse file tree 5 files changed +28
-15
lines changed Expand file tree Collapse file tree 5 files changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ export interface MachineStateSchema {
7474 Initialize : { }
7575 Summary : { }
7676 LoadNext : { }
77+ Error : { }
7778 Level : {
7879 states : {
7980 Load : { }
Original file line number Diff line number Diff line change @@ -22,14 +22,17 @@ const Routes = () => {
2222 < LoadingPage text = "Launching..." context = { { } as CR . MachineContext } />
2323 </ Route >
2424 < Route path = { 'Start.Error' } >
25- < div > Error </ div >
25+ < div > Something went wrong wrong </ div >
2626 </ Route >
2727 < Route path = "Start.SelectTutorial" >
2828 < NewPage send = { tempSend } context = { { } as CR . MachineContext } />
2929 </ Route >
3030 < Route path = "Start.ContinueTutorial" >
3131 < ContinuePage send = { tempSend } context = { { } as CR . MachineContext } />
3232 </ Route >
33+ < Route path = { 'Tutorial.Error' } >
34+ < div > Something went wrong wrong</ div >
35+ </ Route >
3336 < Route path = "Tutorial.Initialize" >
3437 < LoadingPage text = "Initializing..." context = { { } as CR . MachineContext } />
3538 </ Route >
Original file line number Diff line number Diff line change @@ -9,20 +9,28 @@ const styles = {
99 color : '#D8000C' ,
1010 backgroundColor : '#FFBABA' ,
1111 padding : '1rem' ,
12+ width : '100%' ,
13+ height : '100%' ,
1214 } ,
1315}
1416
1517interface Props {
16- error : ApolloError
18+ error ? : ApolloError
1719}
1820
1921const ErrorView = ( { error } : Props ) => {
2022 // log error
2123 React . useEffect ( ( ) => {
22- console . log ( error )
23- onError ( error )
24+ if ( error ) {
25+ console . log ( error )
26+ onError ( error )
27+ }
2428 } , [ ] )
2529
30+ if ( ! error ) {
31+ return null
32+ }
33+
2634 return (
2735 < div css = { styles . container } >
2836 < h1 > Error</ h1 >
Original file line number Diff line number Diff line change @@ -123,13 +123,14 @@ export const createMachine = (options: any) => {
123123 } ) ,
124124 } ,
125125 onError : {
126- target : 'Summary ' ,
126+ target : 'Error ' ,
127127 actions : assign ( {
128128 error : ( context , event ) => event . data ,
129129 } ) ,
130130 } ,
131131 } ,
132132 } ,
133+ Error : { } ,
133134 Summary : {
134135 on : {
135136 LOAD_TUTORIAL : {
Original file line number Diff line number Diff line change @@ -35,26 +35,26 @@ export async function authenticate(context: CR.MachineContext): Promise<any> {
3535 // let message
3636 if ( error . message . match ( / N e t w o r k e r r o r : / ) ) {
3737 return Promise . reject ( {
38- error : {
39- title : 'Network Error' ,
40- description : 'Make sure you have an Internet connection. Restart and try again' ,
41- } ,
38+ title : 'Network Error' ,
39+ description : 'Make sure you have an Internet connection. Restart and try again' ,
4240 } )
4341 } else {
4442 return Promise . reject ( {
45- error : {
46- title : 'Server Error' ,
47- description : error . message ,
48- } ,
43+ title : 'Server Error' ,
44+ description : error . message ,
4945 } )
5046 }
5147 } )
5248
5349 if ( ! result || ! result . data ) {
54- const error = new Error ( 'Authentication request responded with no data' )
50+ const message = 'Authentication request responded with no data'
51+ const error = new Error ( )
5552 console . log ( error )
5653 onError ( error )
57- return
54+ return Promise . reject ( {
55+ title : message ,
56+ description : 'Something went wrong.' ,
57+ } )
5858 }
5959 const { token } = result . data . editorLogin
6060 // add token to headers
You can’t perform that action at this time.
0 commit comments