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

Commit9c95528

Browse files
authored
Merge pull requestcoderoad#80 from ShMcK/feature/sentry
Feature/sentry
2 parentse2e100a +8c07886 commit9c95528

File tree

27 files changed

+631
-950
lines changed

27 files changed

+631
-950
lines changed

‎package-lock.json

Lines changed: 354 additions & 869 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"watch":"tsc -watch -p ./"
3232
},
3333
"dependencies": {
34+
"@sentry/electron":"^1.2.0",
35+
"@sentry/node":"^5.11.0",
3436
"chokidar":"^3.3.0",
3537
"dotenv":"^8.2.0",
3638
"jsdom":"^15.2.1"
@@ -48,6 +50,7 @@
4850
"eslint":"^6.8.0",
4951
"eslint-config-prettier":"^6.9.0",
5052
"eslint-plugin-prettier":"^3.1.2",
53+
"graphql":"^14.5.8",
5154
"prettier":"^1.19.1",
5255
"ts-jest":"^24.3.0",
5356
"typescript":"^3.7.4",

‎src/actions/setupActions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as git from '../services/git'
44
importloadWatchersfrom'./utils/loadWatchers'
55
importopenFilesfrom'./utils/openFiles'
66
importrunCommandsfrom'./utils/runCommands'
7+
importonErrorfrom'../services/sentry/onError'
78

89
constsetupActions=async(
910
workspaceRoot:vscode.WorkspaceFolder,
@@ -16,7 +17,7 @@ const setupActions = async (
1617
if(commits){
1718
for(constcommitofcommits){
1819
// TODO handle git errors
19-
awaitgit.loadCommit(commit)
20+
awaitgit.loadCommit(commit).catch(onError)
2021
}
2122
}
2223

@@ -27,7 +28,7 @@ const setupActions = async (
2728
loadWatchers(watchers||[],workspaceRoot.uri)
2829

2930
// 4. run command
30-
awaitrunCommands(commands||[],send)
31+
awaitrunCommands(commands||[],send).catch(onError)
3132
}
3233

3334
exportdefaultsetupActions

‎src/actions/solutionActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import * as T from 'typings'
22
import*asvscodefrom'vscode'
33
import*asgitfrom'../services/git'
44
importsetupActionsfrom'./setupActions'
5+
importonErrorfrom'../services/sentry/onError'
56

67
constsolutionActions=async(
78
workspaceRoot:vscode.WorkspaceFolder,
89
stepActions:T.StepActions,
910
send:(action:T.Action)=>void,
1011
):Promise<void>=>{
1112
awaitgit.clear()
12-
returnsetupActions(workspaceRoot,stepActions,send)
13+
returnsetupActions(workspaceRoot,stepActions,send).catch(onError)
1314
}
1415

1516
exportdefaultsolutionActions

‎src/actions/tutorialConfig.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as vscode from 'vscode'
44
import{COMMANDS}from'../editor/commands'
55
importlanguageMapfrom'../editor/languageMap'
66
import*asgitfrom'../services/git'
7+
importonErrorfrom'../services/sentry/onError'
78

89
interfaceTutorialConfigParams{
910
config:T.TutorialConfig
@@ -13,13 +14,14 @@ interface TutorialConfigParams {
1314

1415
consttutorialConfig=async(
1516
{ config, alreadyConfigured}:TutorialConfigParams,
16-
onError:(msg:T.ErrorMessage)=>void,
17+
handleError:(msg:T.ErrorMessage)=>void,
1718
)=>{
1819
if(!alreadyConfigured){
1920
// setup git, add remote
2021
awaitgit.initIfNotExists().catch(error=>{
22+
onError(newError('Git not found'))
2123
// failed to setup git
22-
onError({
24+
handleError({
2325
title:error.message,
2426
description:
2527
'Be sure you install Git. See the docs for help https://git-scm.com/book/en/v2/Getting-Started-Installing-Git',
@@ -28,7 +30,8 @@ const tutorialConfig = async (
2830

2931
// TODO if remote not already set
3032
awaitgit.setupRemote(config.repo.uri).catch(error=>{
31-
onError({title:error.message,description:'Remove your current Git project and restarting'})
33+
onError(error)
34+
handleError({title:error.message,description:'Remove your current Git project and restarting'})
3235
})
3336
}
3437

‎src/environment.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ require('dotenv').config({
33
})
44

55
interfaceEnvironment{
6+
VERSION:string
7+
NODE_ENV:string
68
LOG:boolean
79
}
810

911
constenvironment:Environment={
12+
VERSION:process.env.VERSION||'unknown',
13+
NODE_ENV:process.env.NODE_ENV||'production',
1014
LOG:(process.env.LOG||'').toLowerCase()==='true',
1115
}
1216

‎src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// init error logging
2+
import'./services/sentry/init'
3+
14
importEditorfrom'./editor'
25

36
// vscode editor

‎src/services/git/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importnodefrom'../node'
22
importloggerfrom'../logger'
3+
importonErrorfrom'../sentry/onError'
34

45
constgitOrigin='coderoad'
56

@@ -76,13 +77,18 @@ export async function version(): Promise<string | boolean> {
7677
return`${major}${minor}${patch}`
7778
}
7879
}
79-
thrownewError('Git not installed. Please install Git')
80+
constmessage='Git not installed. Please install Git'
81+
consterror=newError(message)
82+
onError(error)
83+
throwerror
8084
}
8185

8286
asyncfunctioninit():Promise<void>{
8387
const{ stderr}=awaitnode.exec('git init')
8488
if(stderr){
85-
thrownewError('Error initializing Git')
89+
consterror=newError('Error initializing Git')
90+
onError(error)
91+
throwerror
8692
}
8793
}
8894

‎src/services/node/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as fs from 'fs'
33
import{join}from'path'
44
import{promisify}from'util'
55
import*asvscodefrom'vscode'
6+
importonErrorfrom'../sentry/onError'
67

78
constasyncExec=promisify(cpExec)
89

@@ -12,7 +13,9 @@ class Node {
1213
// set workspace root for node executions
1314
constworkspaceRoots:vscode.WorkspaceFolder[]|undefined=vscode.workspace.workspaceFolders
1415
if(!workspaceRoots||!workspaceRoots.length){
15-
thrownewError('No workspace root path')
16+
consterror=newError('No workspace root path')
17+
onError(error)
18+
throwerror
1619
}
1720
constworkspaceRoot:vscode.WorkspaceFolder=workspaceRoots[0]
1821
this.workspaceRootPath=workspaceRoot.uri.path

‎src/services/sentry/init.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import{init}from'@sentry/node'
2+
importenvironmentfrom'../../environment'
3+
4+
init({
5+
dsn:'https://df4a6ae19e8b44ed9a87ae4432dab9df@sentry.io/1889368',
6+
environment:environment.NODE_ENV,
7+
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp