diff options
-rw-r--r-- | share/server/main.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/share/server/main.js b/share/server/main.js index dfb0a403..0302721e 100644 --- a/share/server/main.js +++ b/share/server/main.js @@ -344,9 +344,15 @@ while (cmd = eval(readline())) { var rendered = formFun(doc, req); print(toJSON(rendered)); } catch (error) { + // Available error fields: + // message, fileName, lineNumber, stack, name log("form function raised error: "+error.toString()); - log({error:(error||"undefined error")}); - print(toJSON(error)); + log("stacktrace: "+error.stack); + try { + print(toJSON(error)); + } catch (e) { + print({"error":error.toString()}); + } } break; default: |