fix(feishu): extractPermissionError also recognizes code 99991401
Previously extractPermissionError() only checked for error code 99991672,
silently swallowing other Feishu permission error codes like 99991401.
This caused resolveFeishuSenderName() to return {} instead of surfacing
permission errors when the Feishu contact API returned 99991401.
Now also checks for:
- 99991401 (scope not granted)
- 99991672 (permission denied)
- Any non-zero code with 'permission' in the error message
Fixes a bug where permission errors were silently ignored in sender name resolution.
This commit is contained in:
parent
8a05c05596
commit
9bf7da64b6
@ -43,7 +43,12 @@ function extractPermissionError(err: unknown): FeishuPermissionError | null {
|
||||
return null;
|
||||
}
|
||||
const feishuErr = data as { code?: number; msg?: string };
|
||||
if (feishuErr.code !== 99991672) {
|
||||
// Feishu permission/scope error codes: 99991401 (scope not granted) and 99991672 (permission denied)
|
||||
const isPermissionError =
|
||||
feishuErr.code === 99991672 ||
|
||||
feishuErr.code === 99991401 ||
|
||||
(feishuErr.code !== 0 && typeof feishuErr.code === "number" && feishuErr.msg?.toLowerCase().includes("permission"));
|
||||
if (!isPermissionError) {
|
||||
return null;
|
||||
}
|
||||
const msg = feishuErr.msg ?? "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user