mirror of https://github.com/status-im/NimYAML.git
Fixed wrapped exception handling
This commit is contained in:
parent
f2c81f1fc5
commit
24f44b5022
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue