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

Commita66186c

Browse files
authored
Merge pull request#61 from ShMcK/feature/capture-errors
Feature/capture errors
2 parentsf0b8025 +8f91f70 commita66186c

File tree

13 files changed

+363
-367
lines changed

13 files changed

+363
-367
lines changed

‎src/actions/tutorialConfig.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import*asTfrom'typings'
12
import*asGfrom'typings/graphql'
23
import*asvscodefrom'vscode'
34
import*asgitfrom'../services/git'
@@ -10,13 +11,25 @@ interface TutorialConfigParams {
1011
onComplete?():void
1112
}
1213

13-
consttutorialConfig=async({ config, alreadyConfigured}:TutorialConfigParams)=>{
14+
consttutorialConfig=async(
15+
{ config, alreadyConfigured}:TutorialConfigParams,
16+
onError:(msg:T.ErrorMessage)=>void,
17+
)=>{
1418
if(!alreadyConfigured){
1519
// setup git, add remote
16-
awaitgit.initIfNotExists()
20+
awaitgit.initIfNotExists().catch(error=>{
21+
// failed to setup git
22+
onError({
23+
title:error.message,
24+
description:
25+
'Be sure you install Git. See the docs for help https://git-scm.com/book/en/v2/Getting-Started-Installing-Git',
26+
})
27+
})
1728

1829
// TODO: if remote not already set
19-
awaitgit.setupRemote(config.repo.uri)
30+
awaitgit.setupRemote(config.repo.uri).catch(error=>{
31+
onError({title:error.message,description:'Remove your current Git project and restarting'})
32+
})
2033
}
2134

2235
vscode.commands.executeCommand(COMMANDS.CONFIG_TEST_RUNNER,config.testRunner)

‎src/actions/utils/runCommands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const runCommands = async (commands: string[], send: (action: T.Action) => void)
1919
send({type:'COMMAND_FAIL',payload:{process:{ ...process,status:'FAIL'}}})
2020
return
2121
}
22-
console.log(result.stdout)
2322
send({type:'COMMAND_SUCCESS',payload:{process:{ ...process,status:'SUCCESS'}}})
2423
}
2524
}

‎src/channel/index.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import*asCRfrom'typings'
1+
import*asTfrom'typings'
22
import*asGfrom'typings/graphql'
33
import*asvscodefrom'vscode'
44

@@ -10,18 +10,18 @@ import saveCommit from '../actions/saveCommit'
1010
import{COMMANDS}from'../editor/commands'
1111

1212
interfaceChannel{
13-
receive(action:CR.Action):Promise<void>
14-
send(action:CR.Action):Promise<void>
13+
receive(action:T.Action):Promise<void>
14+
send(action:T.Action):Promise<void>
1515
}
1616

1717
interfaceChannelProps{
18-
postMessage:(action:CR.Action)=>Thenable<boolean>
18+
postMessage:(action:T.Action)=>Thenable<boolean>
1919
workspaceState:vscode.Memento
2020
workspaceRoot:vscode.WorkspaceFolder
2121
}
2222

2323
classChannelimplementsChannel{
24-
privatepostMessage:(action:CR.Action)=>Thenable<boolean>
24+
privatepostMessage:(action:T.Action)=>Thenable<boolean>
2525
privateworkspaceState:vscode.Memento
2626
privateworkspaceRoot:vscode.WorkspaceFolder
2727
privatecontext:Context
@@ -34,11 +34,11 @@ class Channel implements Channel {
3434
}
3535

3636
// receive from webview
37-
publicreceive=async(action:CR.Action)=>{
37+
publicreceive=async(action:T.Action)=>{
3838
// action may be an object.type or plain string
3939
constactionType:string=typeofaction==='string' ?action :action.type
40+
constonError=(error:T.ErrorMessage)=>this.send({type:'ERROR',payload:{ error}})
4041

41-
// console.log('EDITOR RECEIVED:', actionType)
4242
switch(actionType){
4343
case'ENV_GET':
4444
this.send({
@@ -87,7 +87,7 @@ class Channel implements Channel {
8787

8888
constdata:G.TutorialData=tutorialData.version.data
8989

90-
awaittutorialConfig({config:data.config})
90+
awaittutorialConfig({config:data.config},onError)
9191

9292
// run init setup actions
9393
if(data.init){
@@ -106,10 +106,13 @@ class Channel implements Channel {
106106
thrownewError('Invalid tutorial to continue')
107107
}
108108
constcontinueConfig:G.TutorialConfig=tutorialContinue.version.data.config
109-
tutorialConfig({
110-
config:continueConfig,
111-
alreadyConfigured:true,
112-
})
109+
tutorialConfig(
110+
{
111+
config:continueConfig,
112+
alreadyConfigured:true,
113+
},
114+
onError,
115+
)
113116
return
114117
case'EDITOR_SYNC_PROGRESS':
115118
// sync client progress on server
@@ -134,8 +137,7 @@ class Channel implements Channel {
134137
}
135138
}
136139
// send to webview
137-
publicsend=async(action:CR.Action)=>{
138-
console.log(`EDITOR SEND${action.type}`)
140+
publicsend=async(action:T.Action)=>{
139141
// action may be an object.type or plain string
140142
constactionType:string=typeofaction==='string' ?action :action.type
141143
switch(actionType){

‎src/editor/ReactWebView.ts

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

‎src/editor/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import*asGfrom'typings/graphql'
22
import*asvscodefrom'vscode'
3-
importReactWebViewfrom'./ReactWebView'
3+
importcreateWebViewfrom'../webview'
44
importcreateTestRunner,{Payload}from'../services/testRunner'
55

66
exportconstCOMMANDS={
@@ -41,7 +41,7 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }:
4141
}
4242

4343
// activate machine
44-
webview=newReactWebView({
44+
webview=createWebView({
4545
extensionPath,
4646
workspaceState,
4747
workspaceRoot,

‎src/services/git/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export async function version(): Promise<string | boolean> {
8181
asyncfunctioninit():Promise<void>{
8282
const{ stderr}=awaitnode.exec('git init')
8383
if(stderr){
84-
thrownewError('Error initializingGits')
84+
thrownewError('Error initializingGit')
8585
}
8686
}
8787

@@ -133,5 +133,7 @@ export async function setupRemote(repo: string): Promise<void> {
133133
// git fetch coderoad
134134
if(!hasRemote){
135135
awaitaddRemote(repo)
136+
}else{
137+
thrownewError('A Remote is already configured')
136138
}
137139
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp