Skip to content

Commit

Permalink
fix: Handle IndexError when parse BinarySize (#2962)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa authored Oct 24, 2024
1 parent f747a61 commit c72719b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/2962.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle `IndexError` when parse string to `BinarySize`
2 changes: 1 addition & 1 deletion src/ai/backend/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def _parse_str(cls, expr: str) -> Union[BinarySize, Decimal]:
# has no suffix and is not an integer
# -> fractional bytes (e.g., 1.5 byte)
raise ValueError("Fractional bytes are not allowed")
except ArithmeticError:
except (ArithmeticError, IndexError):
raise ValueError("Unconvertible value", orig_expr, ending)
try:
multiplier = cls.suffix_map[suffix]
Expand Down

0 comments on commit c72719b

Please sign in to comment.