# std: Catch and handle overflow in json parser · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1fc877fd9473c50a51bc616118250a9fc64d3da0)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1fc877fd9473c50a51bc616118250a9fc64d3da0

Requested commit: 1fc877fd9473c50a51bc616118250a9fc64d3da0

Commit: 1fc877fd9473c50a51bc616118250a9fc64d3da0

Tree: c6dadf06ac0392e5f1d5b4d133b3e331e21dfa77

Author: LemonBoy

Committer: Veikka Tuominen

## Message

```
std: Catch and handle overflow in json parser

When a floating-point value with no fractional part is shoved into an
integer type we must check whether it fits or not before calling
`@floatToInt` as the builtin panics in case of overflow.

Catch the error and bubble it up to the caller.

```

## Parents

- [628f490c59449e38fcc9122968c385997b9e788b](https://git.cafe/gitcafe/zig/commit/628f490c59449e38fcc9122968c385997b9e788b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1fc877fd9473c50a51bc616118250a9fc64d3da0?format=markdown)
