Merge pull request #10526 from mfo/US/fix-IncompleteParseError
tech(mail_checker): rescue Mail::Field::IncompleteParseError
This commit is contained in:
commit
84caed6c30
2 changed files with 10 additions and 0 deletions
|
@ -627,6 +627,8 @@ class EmailChecker
|
|||
return { success: true } if similar_domains.empty?
|
||||
|
||||
{ success: true, email_suggestions: email_suggestions(parsed_email:, similar_domains:) }
|
||||
rescue Mail::Field::IncompleteParseError
|
||||
return { success: false }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -35,5 +35,13 @@ describe EmailCheckerController, type: :controller do
|
|||
expect(body).to eq({ success: false })
|
||||
end
|
||||
end
|
||||
|
||||
context 'incomplete' do
|
||||
let(:params) { { email: 'bikram.subedi81@' } }
|
||||
it do
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(body).to eq({ success: false })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue