Skip to content

Unhandled offline error during deck submission #84

@CravingCrates

Description

@CravingCrates

Summary

When submitting a deck suggestion without an active internet connection, AnkiCollab displays a full Python traceback instead of a user-friendly error message.

Steps to reproduce

  1. Disconnect the device from the internet (or otherwise prevent DNS resolution/network access).
  2. Open Anki and start a deck submission/suggestion through AnkiCollab.
  3. Submit the deck.

Expected behavior

The add-on should gracefully handle network connectivity failures and show a clear message such as:

"Unable to connect to AnkiCollab. Please check your internet connection and try again."

The operation should fail cleanly without exposing an internal traceback.

Actual behavior

The add-on raises an unhandled requests.exceptions.ConnectionError originating from a failed DNS lookup for plugin.ankicollab.com, resulting in a large traceback being shown to the user.

Root cause in the traceback:

requests.exceptions.ConnectionError
└── urllib3.exceptions.MaxRetryError
    └── urllib3.exceptions.NameResolutionError
        └── socket.gaierror

The exception occurs while calling:

deck_repr.get_protected_fields(deckHash)

which ultimately performs:

requests.get(...)

without handling connection-related exceptions. Maybe catch it beforehand or handle gracefully ig

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions