aboutsummaryrefslogtreecommitdiff
path: root/src/link/tapi/yaml.zig
diff options
context:
space:
mode:
authorAli Chraghi <chraghiali1@gmail.com>2022-05-22 19:36:59 +0430
committerAndrew Kelley <andrew@ziglang.org>2022-05-27 16:43:33 -0400
commit0e6285c8fc31ff866df96847fe34e660da38b4a9 (patch)
tree5d5830d5b3ce6c13041aacb7e073763551cb4852 /src/link/tapi/yaml.zig
parentddd5b57045d38b7d1f7d5a4120302797433233cd (diff)
downloadzig-0e6285c8fc31ff866df96847fe34e660da38b4a9.tar.gz
zig-0e6285c8fc31ff866df96847fe34e660da38b4a9.zip
math: make `cast` return optional instead of an error
Diffstat (limited to 'src/link/tapi/yaml.zig')
-rw-r--r--src/link/tapi/yaml.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/link/tapi/yaml.zig b/src/link/tapi/yaml.zig
index e31aa41985..270ae2d8ce 100644
--- a/src/link/tapi/yaml.zig
+++ b/src/link/tapi/yaml.zig
@@ -316,7 +316,7 @@ pub const Yaml = struct {
fn parseValue(self: *Yaml, comptime T: type, value: Value) Error!T {
return switch (@typeInfo(T)) {
- .Int => math.cast(T, try value.asInt()),
+ .Int => math.cast(T, try value.asInt()) orelse error.Overflow,
.Float => math.lossyCast(T, try value.asFloat()),
.Struct => self.parseStruct(T, try value.asMap()),
.Union => self.parseUnion(T, value),