testing error handler
This commit is contained in:
parent
e2af010638
commit
813de065fe
7
app.moon
7
app.moon
@ -15,6 +15,13 @@ class Simplex extends Application
|
||||
@include locate "users"
|
||||
@include locate "api"
|
||||
|
||||
-- TODO intentionally cause an error to see if this is working as intended
|
||||
handle_error: (err, trace) =>
|
||||
if @original_request.route_name\find "api_"
|
||||
return status: 500, json: { errors: {err}, :trace } -- NOTE trace should be saved and NOT returned to the user
|
||||
else
|
||||
super!
|
||||
|
||||
[index: "/"]: =>
|
||||
if @user
|
||||
@keys = APIKeys\select "WHERE user_id = ? ORDER BY id ASC", @user.id
|
||||
|
@ -20,10 +20,6 @@ class API extends Application
|
||||
abort "Invalid api_key." unless @user -- NOTE this should also delete the api_key and error (this should never happen!)
|
||||
)
|
||||
|
||||
-- TODO intentionally cause an error to see if this is working as intended
|
||||
-- handle_error: (err, trace) =>
|
||||
-- return status: 500, json: { errors: {err}, :trace } -- NOTE trace should be saved and NOT returned to the user
|
||||
|
||||
[err_test: "/err"]: api_request =>
|
||||
error "this is a testing error"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user