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