mirror of https://github.com/status-im/NimYAML.git
updated raises annotations
This commit is contained in:
parent
e3e810fce0
commit
f79774e766
|
@ -208,6 +208,8 @@ proc loadDom*(s: Stream | string): YamlDocument
|
|||
raise (ref YamlParserError)(ex.parent)
|
||||
elif ex.parent of IOError:
|
||||
raise (ref IOError)(ex.parent)
|
||||
elif ex.parent of OSError:
|
||||
raise (ref OSError)(ex.parent)
|
||||
else: internalError("Unexpected exception: " & ex.parent.repr)
|
||||
|
||||
proc loadMultiDom*(s: Stream | string): seq[YamlDocument]
|
||||
|
@ -230,6 +232,8 @@ proc loadMultiDom*(s: Stream | string): seq[YamlDocument]
|
|||
raise (ref YamlParserError)(ex.parent)
|
||||
elif ex.parent of IOError:
|
||||
raise (ref IOError)(ex.parent)
|
||||
elif ex.parent of OSError:
|
||||
raise (ref OSError)(ex.parent)
|
||||
else: internalError("Unexpected exception: " & ex.parent.repr)
|
||||
|
||||
proc serializeNode(n: YamlNode, c: SerializationContext, a: AnchorStyle,
|
||||
|
|
|
@ -793,6 +793,7 @@ proc doTransform(c: var Context, input: Stream,
|
|||
var e = getCurrentException()
|
||||
while e.parent of YamlStreamError: e = e.parent
|
||||
if e.parent of IOError: raise (ref IOError)(e.parent)
|
||||
elif e.parent of OSError: raise (ref OSError)(e.parent)
|
||||
elif e.parent of YamlParserError: raise (ref YamlParserError)(e.parent)
|
||||
else: internalError("Unexpected exception: " & e.parent.repr)
|
||||
|
||||
|
@ -802,7 +803,7 @@ proc genInput(input: string): Stream = newStringStream(input)
|
|||
proc transform*(input: Stream | string, output: Stream,
|
||||
options: PresentationOptions = defaultPresentationOptions,
|
||||
resolveToCoreYamlTags: bool = false)
|
||||
{.raises: [IOError, YamlParserError, YamlPresenterJsonError,
|
||||
{.raises: [IOError, OSError, YamlParserError, YamlPresenterJsonError,
|
||||
YamlPresenterOutputError].} =
|
||||
## Parser ``input`` as YAML character stream and then dump it to ``output``
|
||||
## while resolving non-specific tags to the ones in the YAML core tag
|
||||
|
@ -813,7 +814,7 @@ proc transform*(input: Stream | string, output: Stream,
|
|||
proc transform*(input: Stream | string,
|
||||
options: PresentationOptions = defaultPresentationOptions,
|
||||
resolveToCoreYamlTags: bool = false):
|
||||
string {.raises: [IOError, YamlParserError, YamlPresenterJsonError,
|
||||
string {.raises: [IOError, OSError, YamlParserError, YamlPresenterJsonError,
|
||||
YamlPresenterOutputError].} =
|
||||
## Parser ``input`` as YAML character stream, resolves non-specific tags to
|
||||
## the ones in the YAML core tag library, and then returns a serialized
|
||||
|
|
|
@ -1372,10 +1372,12 @@ proc load*[K](input: Stream | string, target: var K)
|
|||
except YamlStreamError:
|
||||
let e = (ref YamlStreamError)(getCurrentException())
|
||||
if e.parent of IOError: raise (ref IOError)(e.parent)
|
||||
if e.parent of OSError: raise (ref OSError)(e.parent)
|
||||
elif e.parent of YamlParserError: raise (ref YamlParserError)(e.parent)
|
||||
else: internalError("Unexpected exception: " & $e.parent.name)
|
||||
|
||||
proc loadAs*[K](input: string): K {.raises: [YamlConstructionError, IOError, YamlParserError].} =
|
||||
proc loadAs*[K](input: string): K {.raises:
|
||||
[YamlConstructionError, IOError, OSError, YamlParserError].} =
|
||||
## Loads the given YAML input to a value of the type K and returns it
|
||||
load(input, result)
|
||||
|
||||
|
@ -1399,6 +1401,7 @@ proc loadMultiDoc*[K](input: Stream | string, target: var seq[K]) =
|
|||
except YamlStreamError:
|
||||
let e = (ref YamlStreamError)(getCurrentException())
|
||||
if e.parent of IOError: raise (ref IOError)(e.parent)
|
||||
elif e.parent of OSError: raise (ref OSError)(e.parent)
|
||||
elif e.parent of YamlParserError: raise (ref YamlParserError)(e.parent)
|
||||
else: internalError("Unexpected exception: " & $e.parent.name)
|
||||
|
||||
|
|
|
@ -191,6 +191,8 @@ when not defined(JS):
|
|||
let e = getCurrentException()
|
||||
if e.parent of IOError:
|
||||
raise (ref IOError)(e.parent)
|
||||
elif e.parent of OSError:
|
||||
raise (ref OSError)(e.parent)
|
||||
elif e.parent of YamlParserError:
|
||||
raise (ref YamlParserError)(e.parent)
|
||||
else: internalError("Unexpected exception: " & e.parent.repr)
|
||||
|
|
Loading…
Reference in New Issue