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

View File

@ -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)