mtempl5.nim 431 B

12345678910111213141516171819202122232425
  1. var
  2. gx = 88
  3. gy = 44
  4. template templ*(): int =
  5. bind gx, gy
  6. gx + gy
  7. import json
  8. const
  9. codeField = "foobar"
  10. messageField = "more"
  11. template trap*(path: string, body: untyped): untyped =
  12. #bind codeField, messageField
  13. try:
  14. body
  15. except:
  16. let msg = getCurrentExceptionMsg()
  17. #debug "Error occurred within RPC ", path = path, errorMessage = msg
  18. result = %*{codeField: "SERVER_ERROR", messageField: msg}