Skip to content

Commit d3611bb

Browse files
committed
Fix returns in case of errors
1 parent 168d361 commit d3611bb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

application.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ class Application < Sinatra::Base
8686
query = Query[api_key: params[:key]]
8787

8888
if query.nil?
89-
status 404 && return
89+
status(404) && return
9090
end
9191

9292
results = query.results(params)
9393

9494
if results[:success]
9595
status 200
9696
else
97-
status 500
97+
status(500) && return
9898
end
9999

100100
body results.to_json

templates/index.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@
9292
[STRING:SubjectName;autosuggest=subjects.name] for an autosuggest served from table 'subject' column 'name'.
9393
%li Note that for comparison with the <code>=</code> you need to wrap the column name in the <code>DATE(columnname)</code> or one of the other date functions in MySQL. <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html">See also the documentation on the MySQL website.</a>
9494
%li The names of the variables can't contain spaces.
95-
%li If you use strings in a comparison, wrap the code around quotes, otherwise MySQL does not know that it is dealing with strings.
95+
%li If you use strings in a comparison, wrap the code around quotes, otherwise MySQL does not know that it is dealing with strings.

0 commit comments

Comments
 (0)