Refactoring exception handling
This commit is contained in:
parent
22ec94590c
commit
954fe7b05a
1 changed files with 6 additions and 9 deletions
|
|
@ -1023,8 +1023,7 @@ routes:
|
|||
let session = executeLogin(c, username, password)
|
||||
setCookie("sid", session)
|
||||
resp Http200, "{}", "application/json"
|
||||
except ForumError:
|
||||
let exc = (ref ForumError)(getCurrentException())
|
||||
except ForumError as exc:
|
||||
resp Http400, $(%exc.data), "application/json"
|
||||
|
||||
get "/status.json":
|
||||
|
|
@ -1282,8 +1281,7 @@ routes:
|
|||
try:
|
||||
await updateProfile(c, username, email, rank)
|
||||
resp Http200, "{}", "application/json"
|
||||
except ForumError:
|
||||
let exc = (ref ForumError)(getCurrentException())
|
||||
except ForumError as exc:
|
||||
resp Http400, $(%exc.data), "application/json"
|
||||
|
||||
post "/sendResetPassword":
|
||||
|
|
@ -1311,8 +1309,7 @@ routes:
|
|||
c, formData["email"].body, recaptcha, request.host
|
||||
)
|
||||
resp Http200, "{}", "application/json"
|
||||
except ForumError:
|
||||
let exc = (ref ForumError)(getCurrentException())
|
||||
except ForumError as exc:
|
||||
resp Http400, $(%exc.data), "application/json"
|
||||
|
||||
post "/resetPassword":
|
||||
|
|
@ -1350,7 +1347,7 @@ routes:
|
|||
)
|
||||
resp Http200, "{}", "application/json"
|
||||
except ForumError as exc:
|
||||
resp Http400, $(%exc.data),"application/json"
|
||||
resp Http400, $(%exc.data), "application/json"
|
||||
|
||||
post "/activateEmail":
|
||||
createTFD()
|
||||
|
|
@ -1371,7 +1368,7 @@ routes:
|
|||
)
|
||||
resp Http200, "{}", "application/json"
|
||||
except ForumError as exc:
|
||||
resp Http400, $(%exc.data),"application/json"
|
||||
resp Http400, $(%exc.data), "application/json"
|
||||
|
||||
get "/t/@id":
|
||||
cond "id" in request.params
|
||||
|
|
@ -1456,4 +1453,4 @@ routes:
|
|||
|
||||
get re"/(.*)":
|
||||
cond request.matches[0].splitFile.ext == ""
|
||||
resp karaxHtml
|
||||
resp karaxHtml
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue