mirror of https://github.com/status-im/NimYAML.git
Fixed server to return proper error messages
This commit is contained in:
parent
034b9b8453
commit
f6e09ebb6a
|
@ -72,7 +72,7 @@ task clean, "Remove all generated files":
|
|||
|
||||
task server, "Compile server daemon":
|
||||
--d:release
|
||||
--d:yamlScalarRepInd
|
||||
--stackTrace
|
||||
setCommand "c", "server/server"
|
||||
|
||||
task testSuiteEvents, "Compile the testSuiteEvents tool":
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
proc shareDir*(): string =
|
||||
result = "$out/share"
|
||||
EOF
|
||||
${pkgs.nim}/bin/nim c --d:release --d:yamlScalarRepInd -p:"${nim-jester}/lib" -p:"${nim-httpbeast}/lib" -p:"${nim-cligen}/lib" --nimcache:.cache server/server
|
||||
${pkgs.nim}/bin/nim c --d:release --stackTrace -p:"${nim-jester}/lib" -p:"${nim-httpbeast}/lib" -p:"${nim-cligen}/lib" --nimcache:.cache server/server
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,share}
|
||||
|
|
|
@ -28,6 +28,7 @@ router nyRouter:
|
|||
of "json": style = psJson
|
||||
of "block": style = psBlockOnly
|
||||
of "tokens":
|
||||
try:
|
||||
var
|
||||
output = "+STR\n"
|
||||
parser = initYamlParser(false)
|
||||
|
@ -37,6 +38,8 @@ router nyRouter:
|
|||
resultNode["code"] = %0
|
||||
resultNode["output"] = %output
|
||||
msg = resultNode.pretty
|
||||
except YamlStreamError as e:
|
||||
raise e.parent
|
||||
else:
|
||||
retStatus = Http400
|
||||
msg = "Invalid style: " & escape(@"style")
|
||||
|
|
Loading…
Reference in New Issue