Skip to content

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Sep 26, 2025

Assertions should enforce invariants, not signal error conditions. Unlike Exceptions, AssertionErrors are not caught by catch (Exception e) and may be more unpredictable.

We should try to only ever use assertions for cases that can never happen unless there's been a programming mistake on our side.

Everything else, e.g. server responses, network errors, client's input (ORM) should be dealt with via exceptions.

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

Assertions should enforce invariants, not signal error conditions.
Unlike Exceptions, AssertionErrors are not caught by catch (Exception e)
and may be more unpredictable.

We should try to only ever use assertions for cases that can never
happen unless there's been a programming mistake on our side.

Everything else, e.g. server responses, network errors, client's input (ORM)
should be dealt with via exceptions.
@bevzzz bevzzz marked this pull request as ready for review September 26, 2025 17:35
@bevzzz bevzzz merged commit 1e4a811 into v6 Sep 26, 2025
2 checks passed
@bevzzz bevzzz deleted the v6-assertions branch September 26, 2025 22:14
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