Exception: BlueFactory::AuthorizationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/blue_factory/errors.rb

Overview

Raised during request processing if the authorization token can't be parsed; it can also be thrown from the user's FeedHandler#get_posts method to indicate that the given user is not authorized to access the requested feed, or that the feed requires authentication and it wasn't provided.

The server intercepts this exception and returns a "401 Unauthorized" response to the AppView, which should result in the app displaying an error banner (along with the provided error message) in the feed view.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = "Authentication required", error_type = "AuthenticationRequired") ⇒ AuthorizationError

Returns a new instance of AuthorizationError.

Parameters:

  • message (String) (defaults to: "Authentication required")

    human-readable error message

  • error_type (String) (defaults to: "AuthenticationRequired")

    machine-readable error code



22
23
24
25
# File 'lib/blue_factory/errors.rb', line 22

def initialize(message = "Authentication required", error_type = "AuthenticationRequired")
  super(message)
  @error_type = error_type
end

Instance Attribute Details

#error_typeString? (readonly)

Returns machine-readable error identifier.

Returns:

  • (String, nil)

    machine-readable error identifier



17
18
19
# File 'lib/blue_factory/errors.rb', line 17

def error_type
  @error_type
end