From f5664c7de0e8ae5346931e5f860fd6098c4ce033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Mon, 12 Jun 2023 10:09:03 +0800 Subject: [PATCH] :art: Improve `BadRequest` --- simnet/errors.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simnet/errors.py b/simnet/errors.py index 662c49f..8a89be4 100644 --- a/simnet/errors.py +++ b/simnet/errors.py @@ -63,6 +63,10 @@ class BadRequest(ApiHelperException): def response(self) -> dict[str, Union[str, Any, None]]: return {"retcode": self.ret_code, "message": self.original} + @property + def retcode(self) -> int: + return self.ret_code + class InternalDatabaseError(BadRequest): """Internal database error."""