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

Commit1c86529

Browse files
authored
Merge pull request#455 from coderoad/fix/error-messages
move error messages to client
2 parents91cc738 +a4d0c9c commit1c86529

15 files changed

+31
-74
lines changed

‎errors/FailedToConnectToGitRepo.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎errors/GitNotFound.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎errors/GitProjectAlreadyExists.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎errors/GitRemoteAlreadyExists.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎errors/MissingTutorialDependency.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎errors/NoWorkspaceFound.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎errors/UnknownError.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎errors/UnmetExtensionVersion.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎errors/UnmetTutorialDependency.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎errors/WorkspaceNotEmpty.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/actions/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ export { default as onTutorialConfigNew } from './onTutorialConfigNew'
33
export{defaultasonTutorialConfigContinue}from'./onTutorialConfigContinue'
44
export{defaultasonValidateSetup}from'./onValidateSetup'
55
export{defaultasonRunReset}from'./onRunReset'
6-
export{defaultasonErrorPage}from'./onErrorPage'
76
export{runTest}from'./onTest'
87
export{onOpenLogs}from'./onOpenLogs'

‎src/actions/onErrorPage.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/commands.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ let sendToClient = (action: T.Action): void => {
2828
// This makes it easier to pass the send
2929
// function throughout the codebase
3030
exportconstsend=(action:T.Action):void=>{
31-
// load error page if error action is triggered
32-
actions.onErrorPage(action)
33-
3431
logger(`EXT TO CLIENT: "${typeofaction==='string' ?action :action.type}"`)
3532

3633
if(action)sendToClient(action)

‎web-app/src/services/errors/en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"FailedToConnectToGitRepo":"### Failed to Connect to Git Repo\n\nThere are several possible causes:\n\n- you may not be connected to the internet or have an unstable connection.\n- you may not have access permission to the remote tutorial repo.\n- the remote tutorial repo may not exist at the provided location",
3+
"GitNotFound":"### Git Not Found\n\nMake sure you have Git installed.\n\nSee the [Git docs](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) for help.",
4+
"GitProjectAlreadyExists":"### Git Remote Already Exists\n\nHave you started this tutorial before in this workspace? The Git remote already exists.\n\nConsider deleting your `.git` folder and restarting.",
5+
"GitRemoteAlreadyExists":"### Git Project Already Exists\n\nCodeRoad requires an empty Git project.\n\nOpen a new workspace to start a tutorial.",
6+
"MissingTutorialDependency":"### Missing Tutorial Dependency\n\nThe tutorial cannot run because it a dependency is not yet installed. Install the dependency and click\"Check Again\".",
7+
"NoWorkspaceFound":"### Open a Workspace Folder\n\nCodeRoad requires a workspace folder to run. Open a new workspace and re-launch CodeRoad.",
8+
"UnknownError":"### Unknown Error\n\nSorry! An unknown error occurred.\n\nPlease help out by posting an issue at github.com/coderoad/coderoad-vscode/issues/new/choose!",
9+
"UnmetExtensionVersion":"### Unmet Extension Version\n\nVSCode extension version is below requirements. Update VSCode to use CodeRoad.",
10+
"UnmetTutorialDependency":"### Unmet Tutorial Dependency\n\nTutorial cannot run because a dependency version doesn't match. Install the correct dependency and click\"Check Again\".",
11+
"WorkspaceNotEmpty":"### Select An Empty VSCode Workspace\n\nStart a project in an empty folder.\n\nOnce selected, the extension will close and need to be re-started."
12+
}

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import*asTfrom'typings'
22
import*asTTfrom'typings/tutorial'
3+
import*asEfrom'typings/error'
34
import{assign,send}from'xstate'
45
import*asselectorsfrom'../../selectors'
56
importgetStepNextfrom'./utils/stepNext'
67
importgetNextfrom'./utils/getNext'
78
importloggerfrom'services/logger'
9+
importerrorsfrom'../../errors/en.json'
810

911
exportconstsetStart=assign({
1012
env:(context:T.MachineContext,event:T.MachineEvent)=>{
@@ -73,8 +75,23 @@ export const reset = assign({
7375

7476
exportconstsetError=assign({
7577
error:(context:T.MachineContext,event:T.MachineEvent):any=>{
76-
constmessage:string|null=event.payload.error
77-
returnmessage
78+
consterror:string|null|E.ErrorMessage=event.payload.error
79+
if(error){
80+
if(typeoferror==='string'){
81+
console.log(`ERROR:${error}`)
82+
returnerror
83+
}elseif(error.type){
84+
consterrorMessage=errors[error.type]
85+
constcontent=errorMessage||''
86+
constmessage=`${content}\n\n${error.message||''}`
87+
console.log(`ERROR:${message}`)
88+
return{
89+
...error,
90+
message,
91+
}
92+
}
93+
}
94+
returnnull
7895
},
7996
})
8097

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp