Sha256: 90775bc92eaa2f79758b8674398726b857c0f55b8a7eb6fc7244c738678c1d25

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

#Copyright (c) 2008-2009 Peter H. Boling of 9thBit LLC
#Released under the MIT license

module SuperExceptionNotifier
  module CustomExceptionMethods
    
    #For a while after disabling a route/URL that had been functional we should set it to resource gone to inform people to remove bookmarks.
    def resource_gone
      raise ResourceGone
    end
    #Then for things that have never existed or have not for a long time we call not_implemented
    def not_implemented
      raise NotImplemented
    end
    #Resources that must be requested with a specific HTTP Meethod (GET, PUT, POST, DELETE, AJAX, etc) but are requested otherwise should:
    def invalid_method
      raise InvalidMethod
    end
    #If your ever at a spot in the code that should never get reached, but corrupt data might get you there anyways then this is for you:
    def corrupt_data
      raise CorruptData
    end
    def page_not_found
      raise PageNotFound
    end
    def record_not_found
      raise ActiveRecord::RecordNotFound
    end
    def method_disabled
      raise MethodDisabled
    end
    #The current user does not have enough privileges to access the requested resource
    def access_denied
      raise AccessDenied
    end

  protected

    def generic_error
      error_stickie("Sorry, an error has occurred.")
      corrupt_data
    end

    def invalid_page
      error_stickie("Sorry, the page number you requested was not valid.")
      page_not_found
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pboling-super_exception_notifier-1.6.5 lib/super_exception_notifier/custom_exception_methods.rb
pboling-super_exception_notifier-1.6.6 lib/super_exception_notifier/custom_exception_methods.rb
pboling-super_exception_notifier-1.6.7 lib/super_exception_notifier/custom_exception_methods.rb
pboling-super_exception_notifier-1.6.8 lib/super_exception_notifier/custom_exception_methods.rb
pboling-super_exception_notifier-1.7.0 lib/super_exception_notifier/custom_exception_methods.rb
pboling-super_exception_notifier-1.7.1 lib/super_exception_notifier/custom_exception_methods.rb