Fixed wrapped exception handling

This commit is contained in:
Felix Krause 2016-01-24 21:38:29 +01:00
parent f2c81f1fc5
commit 24f44b5022
3 changed files with 8 additions and 6 deletions

View File

@ -206,9 +206,9 @@ proc loadToJson*(s: Stream): seq[JsonNode] =
raise e
except YamlConstructionStreamError:
let e = getCurrentException()
if e.parent is IOError:
if e.parent of IOError:
raise cast[ref IOError](e.parent)
elif e.parent is YamlParserError:
elif e.parent of YamlParserError:
raise cast[ref YamlParserError](e.parent)
else:
# can never happen

View File

@ -4,6 +4,8 @@
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
import typetraits
type
DumperState = enum
dBlockExplicitMapKey, dBlockImplicitMapKey, dBlockMapValue,
@ -499,9 +501,9 @@ proc transform*(input: Stream, output: Stream, style: PresentationStyle,
present(events, output, tagLib, style, indentationStep)
except YamlPresenterStreamError:
let e = getCurrentException()
if e.parent is IOError:
if e.parent of IOError:
raise cast[ref IOError](e.parent)
elif e.parent is YamlParserError:
elif e.parent of YamlParserError:
raise cast[ref YamlParserError](e.parent)
else:
# never happens

View File

@ -484,9 +484,9 @@ proc load*[K](input: Stream, target: var K)
raise
except YamlConstructionStreamError:
let e = cast[ref YamlConstructionError](getCurrentException())
if e.parent is IOError:
if e.parent of IOError:
raise cast[ref IOError](e.parent)
elif e.parent is YamlParserError:
elif e.parent of YamlParserError:
raise cast[ref YamlParserError](e.parent)
else:
assert(false)