Skip to content

Instantly share code, notes, and snippets.

@siassaj
Created September 2, 2016 03:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save siassaj/9f1fd91931656278b79d711cadce299b to your computer and use it in GitHub Desktop.
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