Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4097b30

Browse files
ShMcKargemiront
authored andcommitted
distinguish between auth network & server errors (coderoad#82)
1 parent4688851 commit4097b30

File tree

1 file changed

+19
-10
lines changed
  • web-app/src/services/state/actions

1 file changed

+19
-10
lines changed

‎web-app/src/services/state/actions/api.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,28 @@ export default {
3232
})
3333
.catch(error=>{
3434
onError(error)
35-
console.error('ERROR: Authentication failed')
36-
console.error(error)
35+
console.log('ERROR: Authentication failed')
36+
console.log(error.message)
37+
letmessage
38+
if(error.message.match(/Networkerror:/)){
39+
message={
40+
title:'Network Error',
41+
description:'Make sure you have an Internet connection. Restart and try again',
42+
}
43+
}else{
44+
message={
45+
title:'Server Error',
46+
description:error.message,
47+
}
48+
}
49+
channel.receive({data:{type:'ERROR',payload:{error:message}}})
50+
return
3751
})
3852

3953
if(!result||!result.data){
40-
// TODO handle failed authentication
41-
console.error('ERROR: Connection')
42-
consterror={
43-
title:'Connection Failed',
44-
description:
45-
'Either our server is having issues or you may not be connected to the internet. Try checking your connection and restarting the application. ',
46-
}
47-
channel.receive({data:{type:'ERROR',payload:{ error}}})
54+
consterror=newError('Authentication request responded with no data')
55+
console.log(error)
56+
onError(error)
4857
return
4958
}
5059
const{ token}=result.data.editorLogin

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp