feat: 添加 caused_by 字段以便客户端知道是什么情况

This commit is contained in:
CrescentLeaf
2025-10-08 15:13:11 +08:00
parent 5b64c6adcf
commit 23ad29fb2d
2 changed files with 10 additions and 3 deletions

View File

@@ -1,3 +1,6 @@
type ErrorCausedBy =
'NOT_IN_THIS_CHAT_MEMBER_LIST'
type ApiCallbackMessage = { type ApiCallbackMessage = {
msg: string, msg: string,
/** /**
@@ -8,9 +11,9 @@ type ApiCallbackMessage = {
* 404: Not Found * 404: Not Found
* 500: 伺服器端錯誤 * 500: 伺服器端錯誤
* 501: 伺服器端不支持請求的功能 * 501: 伺服器端不支持請求的功能
* -1: 客戶端錯誤
*/ */
code: 200 | 400 | 401 | 403 | 404 | 500 | 501 | -1 code: 200 | 400 | 401 | 403 | 404 | 500 | 501 | -1,
data?: { [key: string]: unknown } data?: { [key: string]: unknown },
caused_by?: ErrorCausedBy,
} }
export default ApiCallbackMessage export default ApiCallbackMessage

View File

@@ -1,3 +1,6 @@
type ErrorCausedBy =
'NOT_IN_THIS_CHAT_MEMBER_LIST'
type ApiCallbackMessage = { type ApiCallbackMessage = {
msg: string, msg: string,
/** /**
@@ -11,5 +14,6 @@ type ApiCallbackMessage = {
*/ */
code: 200 | 400 | 401 | 403 | 404 | 500 | 501, code: 200 | 400 | 401 | 403 | 404 | 500 | 501,
data?: { [key: string]: unknown }, data?: { [key: string]: unknown },
caused_by?: ErrorCausedBy,
} }
export default ApiCallbackMessage export default ApiCallbackMessage