mirror of
https://github.com/status-im/NimYAML.git
synced 2025-01-13 21:15:13 +00:00
replace newException
by constructionError
call if int too large
If an integer doesn't fit into the target type an exception is thrown.
This commit is contained in:
parent
db1a2c4041
commit
446493ded8
@ -204,8 +204,8 @@ proc constructObject*[T: int8|int16|int32|int64](
|
|||||||
# make sure we don't produce a range error
|
# make sure we don't produce a range error
|
||||||
result = T(nInt)
|
result = T(nInt)
|
||||||
else:
|
else:
|
||||||
# if outside of range, what to do?!
|
raise s.constructionError("Cannot construct int; out of range: " &
|
||||||
raise newException(YamlConstructionError, "AAA")
|
$nInt & " for type " & T.name & " with max of: " & $T.high)
|
||||||
|
|
||||||
proc constructObject*(s: var YamlStream, c: ConstructionContext,
|
proc constructObject*(s: var YamlStream, c: ConstructionContext,
|
||||||
result: var int)
|
result: var int)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user