mirror of
https://github.com/logos-storage/asynctest.git
synced 2026-01-07 15:33:07 +00:00
Fix BareExcept warnings
This commit is contained in:
parent
1ef3d36389
commit
cbd6f1ba23
@ -4,14 +4,18 @@ template launderExceptions(body: typed) =
|
|||||||
## exist in asyncdispatch. We therefore launder all real instances of
|
## exist in asyncdispatch. We therefore launder all real instances of
|
||||||
## Exception into CatchableError and make Chronos happy while not losing
|
## Exception into CatchableError and make Chronos happy while not losing
|
||||||
## context information for the remainder of the exception types.
|
## context information for the remainder of the exception types.
|
||||||
|
{.push warning[BareExcept]:off.}
|
||||||
try:
|
try:
|
||||||
|
{.push warning[BareExcept]:on.}
|
||||||
body
|
body
|
||||||
|
{.pop.}
|
||||||
except Defect as ex:
|
except Defect as ex:
|
||||||
raise ex
|
raise ex
|
||||||
except CatchableError as ex:
|
except CatchableError as ex:
|
||||||
raise ex
|
raise ex
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise newException(Defect, ex.msg, ex)
|
raise newException(Defect, ex.msg, ex)
|
||||||
|
{.pop.}
|
||||||
|
|
||||||
template suite*(name, body) =
|
template suite*(name, body) =
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ suite "reports unhandled exception when teardown handles exceptions too":
|
|||||||
teardown:
|
teardown:
|
||||||
try:
|
try:
|
||||||
await someAsyncProc()
|
await someAsyncProc()
|
||||||
except:
|
except CatchableError:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
test "should fail, but not crash":
|
test "should fail, but not crash":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user