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:
Vindaar 2018-10-09 18:31:09 +02:00 committed by flyx
parent db1a2c4041
commit 446493ded8
1 changed files with 2 additions and 2 deletions

View File

@ -204,8 +204,8 @@ proc constructObject*[T: int8|int16|int32|int64](
# make sure we don't produce a range error
result = T(nInt)
else:
# if outside of range, what to do?!
raise newException(YamlConstructionError, "AAA")
raise s.constructionError("Cannot construct int; out of range: " &
$nInt & " for type " & T.name & " with max of: " & $T.high)
proc constructObject*(s: var YamlStream, c: ConstructionContext,
result: var int)