mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 05:22:03 +08:00
Merge branch 'devel-en' into devel-zhs
This commit is contained in:
+21
-14
@@ -1,8 +1,9 @@
|
||||
"""Install exception handler for process crash."""
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
#from subprocess import check_output
|
||||
import threading
|
||||
import capnp
|
||||
from selfdrive.version import version, dirty
|
||||
|
||||
from selfdrive.swaglog import cloudlog
|
||||
@@ -20,24 +21,32 @@ else:
|
||||
from raven import Client
|
||||
from raven.transport.http import HTTPTransport
|
||||
|
||||
with open("/data/openpilot/.git/HEAD", "r") as f:
|
||||
content = f.read().split(' ')
|
||||
branch = content[1]
|
||||
error_tags = {'dirty': dirty, 'branch': branch}
|
||||
error_tags = {'dirty': dirty, 'username': 'char_error'}
|
||||
|
||||
try:
|
||||
with open("/data/data/ai.comma.plus.offroad/files/persistStore/persist-auth", "r") as f:
|
||||
auth = json.loads(f.read())
|
||||
auth = json.loads(auth['commaUser'])
|
||||
error_tags['username'] = auth['username']
|
||||
error_tags['email'] = auth['email']
|
||||
tags = ['username', 'email']
|
||||
for tag in tags:
|
||||
try:
|
||||
error_tags[tag] = ''.join(char for char in auth[tag].decode('utf-8', 'ignore') if char.isalnum())
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
logging_data = {"branch": "/data/params/d/GitBranch", "commit": "/data/params/d/GitCommit", "remote": "/data/params/d/GitRemote"}
|
||||
|
||||
for key in logging_data:
|
||||
try:
|
||||
with open(logging_data[key], "r") as f:
|
||||
error_tags[key] = str(f.read())
|
||||
except:
|
||||
error_tags[key] = "unknown"
|
||||
|
||||
client = Client('https://980a0cba712a4c3593c33c78a12446e1:fecab286bcaf4dba8b04f7cff0188e2d@sentry.io/1488600',
|
||||
install_sys_hook=False, transport=HTTPTransport, release=version, tags=error_tags)
|
||||
try:
|
||||
client.user_context(error_tags['username'])
|
||||
except:
|
||||
pass
|
||||
|
||||
def capture_warning(warning_string):
|
||||
client.captureMessage(warning_string, level='warning')
|
||||
@@ -46,9 +55,7 @@ else:
|
||||
client.captureMessage(info_string, level='info')
|
||||
|
||||
def capture_exception(*args, **kwargs):
|
||||
exc_info = sys.exc_info()
|
||||
if not exc_info[0] is capnp.lib.capnp.KjException:
|
||||
client.captureException(*args, **kwargs)
|
||||
client.captureException(*args, **kwargs)
|
||||
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
|
||||
|
||||
def bind_user(**kwargs):
|
||||
|
||||
Reference in New Issue
Block a user