app/controllers/application_controller.rb
##
# Manages the errors caught by the resuce_from Ropenstack::RopenstackError
# Catches the type of error it is, creates a nice message and then returns the
# request with the correct http code to match the error.
#
Manages the errors caught by the resuce_from Ropenstack::RopenstackError
Catches the type of error it is, creates a nice message and then returns the
request with the correct http code to match the error.
Manages the errors caught by the resuce_from Ropenstack :: RopenstackError Catches the type of error it is creates a nice message and then returns the request with the correct http code to match the error .
def error_respond(exception)
    case exception
    when Ropenstack::NotFoundError then
      code = 404
      message = "Unable to locate on openstack, 404 - Not Found Exception"
    when Ropenstack::UnauthorisedError then
      code = 401
      flash[:error] ||= "Invalid token!"
      message = "You are unauthorised to perform this action on openstack."
    when Ropenstack::TimeoutError then
      code = 503
      message = "Connecting to openstack took to long." +
                "Please check your connection and try again."
    else
      code = 500
      message = "There has been an error on openstack."
    end	
    exp = JSON.parse(exception.to_s)
    respond_to do |format|
      format.json { render :json => {"message" => message, "details" => exp}, :status => code }
    end
  end
def error_respond ( exception ) case exception when Ropenstack :: NotFoundError then code = 404 message = "Unable to locate on openstack, 404 - Not Found Exception" when Ropenstack :: UnauthorisedError then code = 401 flash [ :error ] ||= "Invalid token!" message = "You are unauthorised to perform this action on openstack." when Ropenstack :: TimeoutError then code = 503 message = "Connecting to openstack took to long." + "Please check your connection and try again." else code = 500 message = "There has been an error on openstack." end exp = JSON . parse ( exception . to_s ) respond_to do | format | format . json { render :json => { "message" => message , "details" => exp } , :status => code } end end
Manages the errors caught by the resuce_from Ropenstack::RopenstackError
Catches the type of error it is, creates a nice message and then returns the
request with the correct http code to match the error.
Manages the errors caught by the resuce_from Ropenstack :: RopenstackError Catches the type of error it is creates a nice message and then returns the request with the correct http code to match the error .
exception
<not_specific>