mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Better handling of user exceptions
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||
# See LICENSE for details.
|
||||
|
||||
VERSION = (2, 1, "1.dev1")
|
||||
VERSION = (2, 1, "1.dev2")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -12,7 +12,7 @@ from time import time
|
||||
import click
|
||||
import requests
|
||||
|
||||
from platformio import __version__, app, util
|
||||
from platformio import __version__, app, exception, util
|
||||
|
||||
|
||||
class TelemetryBase(object):
|
||||
@ -219,9 +219,11 @@ def on_event(category, action, label=None, value=None, screen_name=None):
|
||||
|
||||
|
||||
def on_exception(e):
|
||||
if isinstance(e, exception.AbortedByUser):
|
||||
return
|
||||
mp = MeasurementProtocol()
|
||||
mp['exd'] = "%s: %s" % (type(e).__name__, e)
|
||||
mp['exf'] = 1
|
||||
mp['exf'] = int(not isinstance(e, exception.PlatformioException))
|
||||
mp.send("exception")
|
||||
|
||||
|
||||
|
@ -267,9 +267,7 @@ def get_logicaldisks():
|
||||
|
||||
def get_request_defheaders():
|
||||
return {"User-Agent": "PlatformIO/%s CI/%d %s" % (
|
||||
__version__,
|
||||
1 if is_ci() else 0,
|
||||
requests.utils.default_user_agent()
|
||||
__version__, int(is_ci()), requests.utils.default_user_agent()
|
||||
)}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user