Skip to content

Conversation

@harshil0014
Copy link
Collaborator

Problem
call_on_each_event aggressively retries on errors. For client-side errors like
{"result":"error","code":"UNAUTHORIZED"} (bad/expired API key) or
{"code":"BAD_REQUEST"} (invalid params/narrow), this hides the issue and appears
to “silently fail”. This matches the feedback thread linked from the issue.

Change
In Client.call_on_each_event (zulip/zulip/init.py), after the network-exception
handlers and before the existing error branch, detect:

if res.get("result") == "error":
    code = res.get("code")
    if code in ("UNAUTHORIZED", "BAD_REQUEST"):
        raise ZulipError(f"{code}: {res.get('msg', '')}")
@harshil0014
Copy link
Collaborator Author

Hi! I’ve opened a PR (#882) implementing the fail-fast behavior discussed.
call_on_each_event now raises ZulipError immediately on UNAUTHORIZED/BAD_REQUEST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants