app/controllers/dashboard_controller.rb
# Generally, it is best to handle errors in every function for every case,
# however, given that this is a toy application and we will only throw API errors,
# it is ok to do this.
Generally, it is best to handle errors in every function for every case,
however, given that this is a toy application and we will only throw API errors,
it is ok to do this.
Generally it is best to handle errors in every function for every case however given that this is a toy application and we will only throw API errors it is ok to do this .
def rescue_dwolla_errors(exception)
		reset_session if exception.message == "Expired access token." or exception.message == "Invalid access token."
		if exception.message != "Expired access token." or exception.message != "Invalid access token."
			flash[:error] = "Uh oh! A Dwolla API error was encountered: \n#{exception.message}"
			redirect_to :back
		else
			flash[:error] = "An authentication error was encountered and you were logged out. Try again?"
			redirect_to '/'
		end
	end
def rescue_dwolla_errors ( exception ) reset_session if exception . message == "Expired access token." or exception . message == "Invalid access token." if exception . message != "Expired access token." or exception . message != "Invalid access token." flash [ :error ] = "Uh oh! A Dwolla API error was encountered: \n#{exception.message}" redirect_to :back else flash [ :error ] = "An authentication error was encountered and you were logged out. Try again?" redirect_to '/' end end
Generally, it is best to handle errors in every function for every case,
however, given that this is a toy application and we will only throw API errors,
it is ok to do this.
Generally it is best to handle errors in every function for every case however given that this is a toy application and we will only throw API errors it is ok to do this .
exception