testing error handler

This commit is contained in:
Paul Liverman III 2018-04-24 18:35:31 -07:00
parent e2af010638
commit 813de065fe
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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"