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

Feature/capture errors#61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 5 commits intomasterfromfeature/capture-errors
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletionssrc/actions/tutorialConfig.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
import * as T from 'typings'
import * as G from 'typings/graphql'
import * as vscode from 'vscode'
import * as git from '../services/git'
Expand All@@ -10,13 +11,25 @@ interface TutorialConfigParams {
onComplete?(): void
}

const tutorialConfig = async ({ config, alreadyConfigured }: TutorialConfigParams) => {
const tutorialConfig = async (
{ config, alreadyConfigured }: TutorialConfigParams,
onError: (msg: T.ErrorMessage) => void,
) => {
if (!alreadyConfigured) {
// setup git, add remote
await git.initIfNotExists()
await git.initIfNotExists().catch(error => {
// failed to setup git
onError({
title: error.message,
description:
'Be sure you install Git. See the docs for help https://git-scm.com/book/en/v2/Getting-Started-Installing-Git',
})
})

// TODO: if remote not already set
await git.setupRemote(config.repo.uri)
await git.setupRemote(config.repo.uri).catch(error => {
onError({ title: error.message, description: 'Remove your current Git project and restarting' })
})
}

vscode.commands.executeCommand(COMMANDS.CONFIG_TEST_RUNNER, config.testRunner)
Expand Down
1 change: 0 additions & 1 deletionsrc/actions/utils/runCommands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,6 @@ const runCommands = async (commands: string[], send: (action: T.Action) => void)
send({ type: 'COMMAND_FAIL', payload: { process: { ...process, status: 'FAIL' } } })
return
}
console.log(result.stdout)
send({ type: 'COMMAND_SUCCESS', payload: { process: { ...process, status: 'SUCCESS' } } })
}
}
Expand Down
30 changes: 16 additions & 14 deletionssrc/channel/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
import * asCR from 'typings'
import * asT from 'typings'
import * as G from 'typings/graphql'
import * as vscode from 'vscode'

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

interface Channel {
receive(action:CR.Action): Promise<void>
send(action:CR.Action): Promise<void>
receive(action:T.Action): Promise<void>
send(action:T.Action): Promise<void>
}

interface ChannelProps {
postMessage: (action:CR.Action) => Thenable<boolean>
postMessage: (action:T.Action) => Thenable<boolean>
workspaceState: vscode.Memento
workspaceRoot: vscode.WorkspaceFolder
}

class Channel implements Channel {
private postMessage: (action:CR.Action) => Thenable<boolean>
private postMessage: (action:T.Action) => Thenable<boolean>
private workspaceState: vscode.Memento
private workspaceRoot: vscode.WorkspaceFolder
private context: Context
Expand All@@ -34,11 +34,11 @@ class Channel implements Channel {
}

// receive from webview
public receive = async (action:CR.Action) => {
public receive = async (action:T.Action) => {
// action may be an object.type or plain string
const actionType: string = typeof action === 'string' ? action : action.type
const onError = (error: T.ErrorMessage) => this.send({ type: 'ERROR', payload: { error } })

// console.log('EDITOR RECEIVED:', actionType)
switch (actionType) {
case 'ENV_GET':
this.send({
Expand DownExpand Up@@ -87,7 +87,7 @@ class Channel implements Channel {

const data: G.TutorialData = tutorialData.version.data

await tutorialConfig({ config: data.config })
await tutorialConfig({ config: data.config }, onError)

// run init setup actions
if (data.init) {
Expand All@@ -106,10 +106,13 @@ class Channel implements Channel {
throw new Error('Invalid tutorial to continue')
}
const continueConfig: G.TutorialConfig = tutorialContinue.version.data.config
tutorialConfig({
config: continueConfig,
alreadyConfigured: true,
})
tutorialConfig(
{
config: continueConfig,
alreadyConfigured: true,
},
onError,
)
return
case 'EDITOR_SYNC_PROGRESS':
// sync client progress on server
Expand All@@ -134,8 +137,7 @@ class Channel implements Channel {
}
}
// send to webview
public send = async (action: CR.Action) => {
console.log(`EDITOR SEND ${action.type}`)
public send = async (action: T.Action) => {
// action may be an object.type or plain string
const actionType: string = typeof action === 'string' ? action : action.type
switch (actionType) {
Expand Down
189 changes: 0 additions & 189 deletionssrc/editor/ReactWebView.ts
View file
Open in desktop

This file was deleted.

4 changes: 2 additions & 2 deletionssrc/editor/commands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import * as G from 'typings/graphql'
import * as vscode from 'vscode'
importReactWebView from './ReactWebView'
importcreateWebView from '../webview'
import createTestRunner, { Payload } from '../services/testRunner'

export const COMMANDS = {
Expand DownExpand Up@@ -41,7 +41,7 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }:
}

// activate machine
webview =new ReactWebView({
webview =createWebView({
extensionPath,
workspaceState,
workspaceRoot,
Expand Down
4 changes: 3 additions & 1 deletionsrc/services/git/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,7 +81,7 @@ export async function version(): Promise<string | boolean> {
async function init(): Promise<void> {
const { stderr } = await node.exec('git init')
if (stderr) {
throw new Error('Error initializingGits')
throw new Error('Error initializingGit')
}
}

Expand DownExpand Up@@ -133,5 +133,7 @@ export async function setupRemote(repo: string): Promise<void> {
// git fetch coderoad
if (!hasRemote) {
await addRemote(repo)
} else {
throw new Error('A Remote is already configured')
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp