Cannot get param `message` in exception

I use abort(401, "something") in my code and catch the exception with a function

async def handle_401s(request, exception: Unauthorized):
    return response.json({"err": exception.message})

It always returns 500.
When I checked the source code I found that the param message had not been set to class Unauthorized. Please tell me a way to get message from exception. Thanks

Like with built-in exceptions, str(e) or f"{e}", which do not include exception name but only the message (if you need exception name too, use repr(e) or f"{e!r}", or type(e).__name__).