Skip to content

fix: replace bare except with except Exception#477

Open
harshadkhetpal wants to merge 2 commits intoAnubisLMS:mainfrom
harshadkhetpal:fix/bare-except-webhook-lectures
Open

fix: replace bare except with except Exception#477
harshadkhetpal wants to merge 2 commits intoAnubisLMS:mainfrom
harshadkhetpal:fix/bare-except-webhook-lectures

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replace bare except: clauses with except Exception: in webhook and lectures modules.

Bare except: catches all exceptions including SystemExit, KeyboardInterrupt, and GeneratorExit, which is almost never intended. Using except Exception: follows PEP 8 best practices.

Changes:

# Before (webhook.py:63)
except:
    logger.error(traceback.format_exc())

# After
except Exception:
    logger.error(traceback.format_exc())

# Before (lectures.py:105, 173)
except:
    post_time = None

# After
except Exception:
    post_time = None

Files Changed

  • api/anubis/utils/discord/webhook.py — 1 bare except → except Exception
  • api/anubis/views/admin/lectures.py — 2 bare except → except Exception

Testing

No behavior change for normal exceptions — style/correctness fix only.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant