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

Commitca07f5c

Browse files
committed
add web Sentry
1 parent0213633 commitca07f5c

File tree

8 files changed

+97
-2
lines changed

8 files changed

+97
-2
lines changed

‎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/sentry/onError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as sentry from '@sentry/node'
22
import{Scope}from'@sentry/hub'
33
importenvironmentfrom'../../environment'
44

5-
constonError=error=>{
5+
constonError=(error:Error)=>{
66
// set user scope https://docs.sentry.io/enriching-error-data/scopes/?platform=node
77
sentry.withScope((scope:Scope)=>{
88
scope.setTag('VERSION',environment.VERSION)

‎web-app/package-lock.json

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

‎web-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@alifd/theme-4":"^0.2.3",
3030
"@apollo/react-hooks":"^3.1.3",
3131
"@emotion/core":"^10.0.27",
32+
"@sentry/browser":"^5.11.1",
3233
"apollo-boost":"^0.4.7",
3334
"graphql":"^14.5.8",
3435
"markdown-it":"^10.0.0",

‎web-app/src/environment.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
// }
77
// }
88

9-
exportconstGQL_URI:string=process.env.REACT_APP_GQL_URI||'https://33mf420q4m.execute-api.us-west-2.amazonaws.com/stage/api-stage'
9+
exportconstGQL_URI:string=
10+
process.env.REACT_APP_GQL_URI||'https://33mf420q4m.execute-api.us-west-2.amazonaws.com/stage/api-stage'
1011
exportconstDEBUG:boolean=(process.env.REACT_APP_DEBUG||'').toLowerCase()==='true'
12+
exportconstVERSION:string=process.env.VERSION||'unknown'
13+
exportconstNODE_ENV:string=process.env.NODE_ENV||'producton'

‎web-app/src/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import*asReactfrom'react'
22
importReactDOMfrom'react-dom'
33
importAppfrom'./App'
4+
5+
// init error logging
6+
import'./services/sentry/init'
7+
// init initial styles
48
import'./styles/index.css'
9+
// init listeners
510
import'./services/listeners'
611

712
ReactDOM.render(<App/>,document.getElementById('root')asHTMLElement)

‎web-app/src/services/sentry/init.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import*assentryfrom'@sentry/browser'
2+
import{NODE_ENV}from'../../environment'
3+
4+
sentry.init({
5+
dsn:'https://701cee76c32a4408b2fcb6af3e139d46@sentry.io/1889371',
6+
environment:NODE_ENV,
7+
})
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import*assentryfrom'@sentry/node'
2+
import{Scope}from'@sentry/hub'
3+
import{VERSION}from'../../environment'
4+
5+
constonError=(error:Error)=>{
6+
// set user scope https://docs.sentry.io/enriching-error-data/scopes/?platform=node
7+
sentry.withScope((scope:Scope)=>{
8+
scope.setTag('VERSION',VERSION)
9+
// if (user) {
10+
// scope.setUser({
11+
// id: user.id,
12+
// email: user.email || 'unknown',
13+
// })
14+
// }
15+
sentry.captureException(error)
16+
})
17+
}
18+
19+
exportdefaultonError

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp