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

Commit820711f

Browse files
authored
Merge pull request#527 from coderoad/feat/detect-failed-launch
Resolve failed launch on CodeAlly
2 parents060ad10 +055024e commit820711f

File tree

10 files changed

+29
-15
lines changed

10 files changed

+29
-15
lines changed

‎src/actions/onStartup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ const onStartup = async (context: Context): Promise<void> => {
4242
consttutorial=awaittutorialRes.json()
4343
send({type:'START_TUTORIAL_FROM_URL',payload:{ tutorial}})
4444
return
45-
}catch(e){
45+
}catch(e:any){
4646
// on failure to load a tutorial url fallback to NEW
47-
console.log(`Failed to load tutorial from url${TUTORIAL_URL} with error "${e.message}"`)
47+
thrownewError(`Failed to load tutorial from url${TUTORIAL_URL} with error "${e.message}"`)
4848
}
4949
}
5050
// NEW from start click
@@ -56,7 +56,7 @@ const onStartup = async (context: Context): Promise<void> => {
5656
const{ position}=awaitcontext.onContinue(tutorial)
5757
// communicate to client the tutorial & stepProgress state
5858
send({type:'LOAD_STORED_TUTORIAL',payload:{ env, tutorial, position}})
59-
}catch(e){
59+
}catch(e:any){
6060
consterror={
6161
type:'UnknownError',
6262
message:`Location: Editor startup\n\n${e.message}`,

‎src/actions/onTutorialConfigContinue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const onTutorialConfigContinue = async (action: T.Action, context: Context): Pro
2525
if(tutorialToContinue.config?.webhook){
2626
setupWebhook(tutorialToContinue.config.webhook)
2727
}
28-
}catch(e){
28+
}catch(e:any){
2929
consterror={
3030
type:'UnknownError',
3131
message:`Location: Editor tutorial continue config.\n\n${e.message}`,

‎src/channel.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class Channel implements Channel {
2020

2121
// receive from webview
2222
publicreceive=async(action:T.Action):Promise<void>=>{
23+
if(action.source!=='coderoad'){
24+
// filter out events from other extensions
25+
return
26+
}
27+
2328
// action may be an object.type or plain string
2429
constactionType:string=typeofaction==='string' ?action :action.type
2530

‎src/services/hooks/utils/openFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const openFiles = async (files: string[] = []): Promise<void> => {
1515
constabsoluteFilePath=join(wr,filePath)
1616
constdoc=awaitvscode.workspace.openTextDocument(absoluteFilePath)
1717
awaitvscode.window.showTextDocument(doc,vscode.ViewColumn.One)
18-
}catch(error){
18+
}catch(error:any){
1919
console.log(`Failed to open file${filePath}:${error.message}`)
2020
}
2121
}

‎src/services/hooks/utils/runCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const runCommands = async (commands: string[] = []): Promise<void> => {
1515
try{
1616
result=awaitexec({ command})
1717
console.log(result)
18-
}catch(error){
18+
}catch(error:any){
1919
console.error(`Command failed:${error.message}`)
2020
send({type:'COMMAND_FAIL',payload:{process:{ ...process,status:'FAIL'}}})
2121
return

‎src/services/reset/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const reset = async ({ branch, hash }: Input): Promise<void> => {
6363
awaitexec({
6464
command:`git reset --hard${hash}`,
6565
})
66-
}catch(error){
66+
}catch(error:any){
6767
console.error('Error resetting')
6868
console.error(error.message)
6969
}

‎src/services/testRunner/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks): ((params: an
7575
}
7676
logger('COMMAND',command)
7777
result=awaitexec({ command,dir:testRunnerConfig.directory})
78-
}catch(err){
78+
}catch(err:any){
7979
result={stdout:err.stdout,stderr:err.stack}
8080
}
8181

‎src/services/webview/create.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ const createReactWebView = ({ extensionPath, channel }: ReactWebViewProps): Outp
5656

5757
// Handle messages from the webview
5858
constreceive=channel.receive
59-
constsend=(action:T.Action)=>panel.webview.postMessage(action)
59+
constsend=(action:T.Action)=>
60+
panel.webview.postMessage({
61+
...action,
62+
source:'coderoad',// filter events on client by source. origin is not reliable
63+
})
6064

6165
panel.webview.onDidReceiveMessage(receive,null,disposables)
6266

‎typings/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export interface Position {
4949
// current tutorial state
5050

5151
exportinterfaceAction{
52+
source?:'coderoad'// filter received actions by this
5253
type:string
5354
payload?:any
5455
meta?:any

‎web-app/src/services/state/useStateMachine.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ declare let acquireVsCodeApi: any
1616
consteditor=acquireVsCodeApi()
1717
consteditorSend=(action:T.Action)=>{
1818
logger(`TO EXT: "${action.type}"`)
19-
returneditor.postMessage(action)
19+
returneditor.postMessage({
20+
...action,
21+
source:'coderoad',// filter events by source on editor side
22+
})
2023
}
2124

2225
// router finds first state match of <Route path='' />
@@ -31,14 +34,15 @@ const useStateMachine = (): Output => {
3134
// event bus listener
3235
React.useEffect(()=>{
3336
constlistener='message'
34-
//propograte channel event to state machine
37+
//propagate channel event to state machine
3538
consthandler=(event:any)=>{
36-
// ensure events are coming from coderoad webview
37-
if(!event.origin.match(/^vscode-webview/)){
38-
return
39-
}
4039
// NOTE: must call event.data, cannot destructure. VSCode acts odd
4140
constaction=event.data
41+
42+
if(action.source!=='coderoad'){
43+
// filter out events from other extensions
44+
return
45+
}
4246
sendWithLog(action)
4347
}
4448
window.addEventListener(listener,handler)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp