diff --git a/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb b/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb index f8dfcd9b6..9e4baba9e 100644 --- a/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb +++ b/enterprise/app/services/enterprise/whatsapp/providers/whatsapp_cloud_service.rb @@ -80,6 +80,6 @@ module Enterprise::Whatsapp::Providers::WhatsappCloudService raise Voice::CallErrors::NoCallPermission, error_msg if error_code == 138_006 - raise StandardError, error_msg + raise Voice::CallErrors::CallFailed, error_msg end end diff --git a/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb b/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb index 5e5344deb..9c90d9ccb 100644 --- a/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb +++ b/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb @@ -58,12 +58,12 @@ describe Whatsapp::Providers::WhatsappCloudService do .to raise_error(Voice::CallErrors::NoCallPermission, 'No call permission') end - it 'raises StandardError with a fallback message when the error body is non-JSON' do + it 'raises Voice::CallErrors::CallFailed with a fallback message when the error body is non-JSON' do stub_request(:post, calls_url).to_return(status: 502, body: '502 Bad Gateway', headers: { 'Content-Type' => 'text/html' }) expect { service.initiate_call('15551234567', 'sdp_offer') } - .to raise_error(StandardError, 'Failed to initiate call') + .to raise_error(Voice::CallErrors::CallFailed, 'Failed to initiate call') end end end