Skip to content
Snippets Groups Projects
Commit b4760586 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

traceback on no exception

parent 182c2251
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Python 3.4 znów wspierany * Python 3.4 znów wspierany
* Domyślny czas dla TimeBasedHeap * Domyślny czas dla TimeBasedHeap
* Traceback uruchamiany bez wyjątku będzie rzucał ValueError
## v2.0.12 ## v2.0.12
......
...@@ -208,6 +208,8 @@ class Traceback(object): ...@@ -208,6 +208,8 @@ class Traceback(object):
To be invoked while processing an exception is in progress To be invoked while processing an exception is in progress
:param policy: policy for traceback generation :param policy: policy for traceback generation
:raise ValueError: there is no traceback to get info from!
Is any exception in process?
""" """
if inspect.isclass(policy): if inspect.isclass(policy):
...@@ -218,7 +220,7 @@ class Traceback(object): ...@@ -218,7 +220,7 @@ class Traceback(object):
self.frames = [] self.frames = []
if tb is None: if tb is None:
self.formatted_traceback = u'No exception.' raise ValueError('No traceback')
else: else:
while tb.tb_next: while tb.tb_next:
tb = tb.tb_next tb = tb.tb_next
......
[metadata] [metadata]
name = satella name = satella
version = 2.0.13rc2 version = 2.0.13
description-file = README.md description-file = README.md
author = Piotr Maślanka author = Piotr Maślanka
author_email = piotrm@smok.co author_email = piotrm@smok.co
......
...@@ -10,7 +10,7 @@ from satella.instrumentation import Traceback ...@@ -10,7 +10,7 @@ from satella.instrumentation import Traceback
class TestTraceback(unittest.TestCase): class TestTraceback(unittest.TestCase):
def test_no_exc(self): def test_no_exc(self):
tb = Traceback() self.assertRaises(ValueError, Traceback)
def test_tb(self): def test_tb(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment