1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-11-29 07:18:48 +09:00

Meaningful validation errors in API response

This commit is contained in:
Eugen Rochko 2016-09-30 22:31:16 +02:00
parent 62b057b085
commit 96ad9b0db1

View File

@ -2,8 +2,8 @@ class ApiController < ApplicationController
protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token
rescue_from ActiveRecord::RecordInvalid do
render json: { error: 'Record invalid' }, status: 422
rescue_from ActiveRecord::RecordInvalid do |e|
render json: { error: e.to_s }, status: 422
end
rescue_from ActiveRecord::RecordNotFound do