Better error handling

This commit is contained in:
Ivan Kravets
2015-12-18 19:58:09 +02:00
parent e4dbcd50cc
commit 132c769766
2 changed files with 11 additions and 5 deletions

View File

@ -109,7 +109,11 @@ def main():
An unexpected error occurred. Further steps:
* Verify that you have the latest version of PlatformIO using
`platformio upgrade` command
`pip install -U platformio` command
* Try to find answer in FAQ Troubleshooting section
http://docs.platformio.org/en/latest/faq.html
* Report this problem to the developers
https://github.com/platformio/platformio/issues

View File

@ -22,6 +22,7 @@ import uuid
from collections import deque
from os import getenv
from time import sleep, time
from traceback import format_exc
import click
import requests
@ -289,12 +290,13 @@ 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'] = int(any([
is_crash = any([
not isinstance(e, exception.PlatformioException),
"Error" in e.__class__.__name__
]))
])
mp = MeasurementProtocol()
mp['exd'] = "%s: %s" % (type(e).__name__, format_exc() if is_crash else e)
mp['exf'] = 1 if is_crash else 0
mp.send("exception")