Not that you need std/unittest but this is a faux example of what you might want to do.
import std/unittest
type YourException = ref object of CatchableError
a: int
suite("Test"):
test("a"):
try:
raise YourException(a: 300, msg: "hello")
except YourException as e:
assert e.a == 300
assert e.msg == "hello"