From 9aa37b32c3307dcb5896e1b768967666a6fdbf65 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 1 Mar 2021 04:59:13 +0100 Subject: Add `details` to error response for `POST /api/v1/accounts` in REST API (#15803) --- app/controllers/api/v1/accounts_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers/api/v1') diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 953874e1a..996f1b79b 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -27,6 +27,8 @@ class Api::V1::AccountsController < Api::BaseController self.response_body = Oj.dump(response.body) self.status = response.status + rescue ActiveRecord::RecordInvalid => e + render json: ValidationErrorFormatter.new(e, :'account.username' => :username, :'invite_request.text' => :reason).as_json, status: :unprocessable_entity end def follow -- cgit