Implementation of /measure, /measurements APIs.
This commit is contained in:
@ -14,6 +14,9 @@ type
|
||||
cfg*: PMApiConfig
|
||||
db*: PMApiDb
|
||||
|
||||
BadRequestError* = object of CatchableError
|
||||
AuthError* = object of CatchableError
|
||||
|
||||
proc `%`*(cfg: PMApiConfig): JsonNode =
|
||||
result = %* {
|
||||
"authSecret": cfg.authSecret,
|
||||
@ -22,6 +25,10 @@ proc `%`*(cfg: PMApiConfig): JsonNode =
|
||||
"port": cfg.port,
|
||||
"pwdCost": cfg.pwdCost }
|
||||
|
||||
template raiseEx*(errorType: type, reason: string): void =
|
||||
raise newException(errorType, reason)
|
||||
|
||||
proc raiseEx*(reason: string): void =
|
||||
raise newException(Exception, reason)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user