Skip to content

Idea: use panic codes instead of custom errors #4867

Closed
@Amxx

Description

There are some cases where we use custom error, but Panic codes may be more relevant/standard.

Some example (not exaustive):

  • In Math.mulDiv, if the prod1 > denominator, we should probably Panic with 0x11 (ARITHMETIC_UNDER_OR_OVERFLOW) if denominator > 0 or 0x12 (DIVISION_BY_ZERO) if denominator == 0 instead of using MathOverflowedMulDiv

  • In DoubleEndedQueue, we should probably replace

    • QueueEmpty → panic 0x31 (POP_ON_EMPTY_ARRAY)
    • QueueFull → panic 0x32 (ARRAY_ACCESS_OUT_OF_BOUNDS)
    • QueueOutOfBounds → panic 0x41 (TOO_MUCH_MEMORY_ALLOCATED)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions