api: properly serialize the exception's traceback
Use `traceback.print_tb()` to serialize the exceptions' backtrace. The previously used expression `str(e.__traceback__)` will just give `<traceback object at 0x…>`, which is not very helpful. Add a test to check that the method name that raises the exception, also called `exception`, is in the traceback.
This commit is contained in:
parent
7a112c27cb
commit
aaa51e22a6
2 changed files with 5 additions and 1 deletions
|
|
@ -103,6 +103,7 @@ class TestAPI(unittest.TestCase):
|
|||
self.assertIn(field, e, f"Exception needs '{field}'")
|
||||
self.assertEqual(e["value"], "osbuild test exception")
|
||||
self.assertEqual(e["type"], "ValueError")
|
||||
self.assertIn("exception", e["traceback"])
|
||||
|
||||
def test_metadata(self):
|
||||
# Check that `api.metadata` leads to `API.metadata` being
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue