mirror of https://github.com/status-im/NimYAML.git
Fixed error reporting in server
This commit is contained in:
parent
daafa8b8e8
commit
d7498f1c8a
|
@ -31,15 +31,14 @@ routes:
|
||||||
resultNode["code"] = %0
|
resultNode["code"] = %0
|
||||||
resultNode["output"] = %output.data
|
resultNode["output"] = %output.data
|
||||||
resp resultNode.pretty, "application/json"
|
resp resultNode.pretty, "application/json"
|
||||||
except YamlPresenterStreamError:
|
except YamlParserError:
|
||||||
let e = (ref YamlParserError)(getCurrentException().parent)
|
let e = (ref YamlParserError)(getCurrentException())
|
||||||
resultNode["code"] = %1
|
resultNode["code"] = %1
|
||||||
resultNode["line"] = %e.line
|
resultNode["line"] = %e.line
|
||||||
resultNode["column"] = %e.column
|
resultNode["column"] = %e.column
|
||||||
resultNode["message"] = %e.msg
|
resultNode["message"] = %e.msg
|
||||||
resultNode["detail"] = %e.lineContent
|
resultNode["detail"] = %e.lineContent
|
||||||
resp resultNode.pretty, "application/json"
|
resp resultNode.pretty, "application/json"
|
||||||
|
|
||||||
except YamlPresenterJsonError:
|
except YamlPresenterJsonError:
|
||||||
let e = getCurrentException()
|
let e = getCurrentException()
|
||||||
resultNode["code"] = %2
|
resultNode["code"] = %2
|
||||||
|
@ -48,8 +47,8 @@ routes:
|
||||||
resp resultNode.pretty, "application/json"
|
resp resultNode.pretty, "application/json"
|
||||||
except:
|
except:
|
||||||
let e = getCurrentException()
|
let e = getCurrentException()
|
||||||
let msg = "Name: " & $e.name & "\nMessage: " & e.msg & "\nTrace:\n" &
|
let msg = "Name: " & $e.name & "\nMessage: " & e.msg &
|
||||||
e.getStackTrace
|
"\nTrace:\n" & e.getStackTrace
|
||||||
resp Http500, msg, "text/plain;charset=utf-8"
|
resp Http500, msg, "text/plain;charset=utf-8"
|
||||||
|
|
||||||
runForever()
|
runForever()
|
||||||
|
|
Loading…
Reference in New Issue