Files
gitlabhq/lib/api.rb
T
Felix Gilcher 2a669fc899 rescue all errors and return the proper format
This rescues all errors and returns a proper JSON response. Fixes #2833.
2013-01-29 18:20:59 +01:00

28 lines
562 B
Ruby

Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module Gitlab
class API < Grape::API
version 'v3', using: :path
rescue_from ActiveRecord::RecordNotFound do
rack_response({'message' => '404 Not found'}.to_json, 404)
end
rescue_from :all do
rack_response({'message' => '500 Internal Server Error'}, 500)
end
format :json
error_format :json
helpers APIHelpers
mount Users
mount Projects
mount Issues
mount Milestones
mount Session
mount MergeRequests
mount Notes
end
end