mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
25 lines
431 B
Nim
25 lines
431 B
Nim
|
|
var
|
|
gx = 88
|
|
gy = 44
|
|
|
|
template templ*(): int =
|
|
bind gx, gy
|
|
gx + gy
|
|
|
|
import json
|
|
|
|
const
|
|
codeField = "foobar"
|
|
messageField = "more"
|
|
|
|
template trap*(path: string, body: untyped): untyped =
|
|
#bind codeField, messageField
|
|
try:
|
|
body
|
|
except:
|
|
let msg = getCurrentExceptionMsg()
|
|
#debug "Error occurred within RPC ", path = path, errorMessage = msg
|
|
result = %*{codeField: "SERVER_ERROR", messageField: msg}
|
|
|