From 0e9c1a297aa15570d87da356f2ac908f1fd433a3 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 17 Sep 2016 17:03:36 +0200 Subject: Improved error handling for FollowRemoteService --- app/controllers/api_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/controllers/api_controller.rb') diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index bacdd997b..cbe7141b9 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -10,6 +10,14 @@ class ApiController < ApplicationController render json: { error: 'Record not found' }, status: 404 end + rescue_from Goldfinger::Error do + render json: { error: 'Remote account could not be resolved' }, status: 422 + end + + rescue_from HTTP::Error do + render json: { error: 'Remote data could not be fetched' }, status: 503 + end + protected def current_resource_owner -- cgit