Bugfix: Fix nested error messages from faulty rescue clause

This commit is contained in:
Ryan Lue 2020-03-22 15:56:56 +08:00 committed by Thorsten Eckel
parent 64e08dfc48
commit ad5bc765fd
2 changed files with 5 additions and 5 deletions

View file

@ -160,9 +160,9 @@ class ExternalCredential::Twitter
rescue
begin
webhooks = client.webhooks
raise "Unable to get list of webooks. You use the wrong 'Dev environment label', only #{webhooks.inspect} available."
rescue => e
raise "Unable to get list of webooks. Maybe you do not have an Twitter developer approval right now or you use the wrong 'Dev environment label': #{e.message}"
raise "Dev Environment Label invalid. Please use an existing one #{webhooks[:environments].map { |e| e[:environment_name] }}, or create a new one."
rescue Twitter::Error => e
raise "#{e.message} Are you sure you created a development environment on developer.twitter.com?"
end
end
webhook_id = nil

View file

@ -248,7 +248,7 @@ RSpec.describe 'External Credentials', type: :request do
include_examples 'for failure cases' do
let(:status) { :ok }
let(:error_message) { <<~ERR.chomp }
Unable to get list of webooks. Maybe you do not have an Twitter developer approval right now or you use the wrong 'Dev environment label': Forbidden.
Forbidden. Are you sure you created a development environment on developer.twitter.com?
ERR
end
end
@ -260,7 +260,7 @@ RSpec.describe 'External Credentials', type: :request do
include_examples 'for failure cases' do
let(:status) { :ok }
let(:error_message) { <<~ERR.chomp }
Unable to get list of webooks. Maybe you do not have an Twitter developer approval right now or you use the wrong 'Dev environment label': Unable to get list of webooks. You use the wrong 'Dev environment label', only {:environments=>[{:environment_name=>\"zammad\", :webhooks=>[]}]} available.
Dev Environment Label invalid. Please use an existing one ["zammad"], or create a new one.
ERR
end
end