Created
September 2, 2016 03:20
-
-
Save siassaj/9f1fd91931656278b79d711cadce299b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if @company.update_attributes(update_company_params) | |
begin | |
raise PromisePayableCompany::CouldntCreateBankAccountError, @company | |
user = @company.users.first | |
pp_company = PromisePayableCompany.new(@company, user) | |
pp_company.maybe_attach_user | |
pp_company.maybe_attach_company | |
rescue PromisePayableCompany::CouldntCreateUserError, | |
PromisePayableCompany::CouldntCreateCompanyError, | |
PromisePayableCompany::CouldntCreateBankAccountError => e | |
Rails.logger.error e | |
Raven.capture_exception(e) | |
flash[:alert] = "There was a problem registering your company with Promise Pay."\ | |
" We've been notified, but you can also contact us"\ | |
" <a href='/contact'>here</a>." | |
@company.revert_step! | |
rescue Faraday::ConnectionFailed => e | |
Rails.logger.error e | |
Raven.capture_exception(e) | |
flash[:alert] = "There was a problem connecting to Promise Pay to set up your"\ | |
" account. It's most likely a network issue. Please try again"\ | |
" in a few minutes." | |
@company.revert_step! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment