about summary refs log tree commit diff
path: root/app/controllers/api/v1
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-03-01 04:59:13 +0100
committerGitHub <noreply@github.com>2021-03-01 04:59:13 +0100
commit9aa37b32c3307dcb5896e1b768967666a6fdbf65 (patch)
treed10630dcc1a46d450be7b711e9ae47c91492d2cf /app/controllers/api/v1
parentb4cb8c3c8356e226061fd70ae2139318c6a558e5 (diff)
Add `details` to error response for `POST /api/v1/accounts` in REST API (#15803)
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r--app/controllers/api/v1/accounts_controller.rb2
1 files changed, 2 insertions, 0 deletions
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