mirror of
https://github.com/kikobar/mastodon.git
synced 2024-11-18 13:17:35 +00:00
Meaningful validation errors in API response
This commit is contained in:
parent
62b057b085
commit
96ad9b0db1
|
@ -2,8 +2,8 @@ class ApiController < ApplicationController
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
|
|
||||||
rescue_from ActiveRecord::RecordInvalid do
|
rescue_from ActiveRecord::RecordInvalid do |e|
|
||||||
render json: { error: 'Record invalid' }, status: 422
|
render json: { error: e.to_s }, status: 422
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_from ActiveRecord::RecordNotFound do
|
rescue_from ActiveRecord::RecordNotFound do
|
||||||
|
|
Loading…
Reference in a new issue