Module: ExceptionHub::Configuration
- Included in:
- ExceptionHub
- Defined in:
- lib/exception_hub/configuration.rb
Constant Summary collapse
- IGNORED_EXCEPTIONS_DEFAULT =
['ActiveRecord::RecordNotFound', 'ActionController::RoutingError', 'ActionController::InvalidAuthenticityToken', 'CGI::Session::CookieStore::TamperedWithCookie', 'ActionController::UnknownAction', 'AbstractController::ActionNotFound', 'Mongoid::Errors::DocumentNotFound']
Instance Attribute Summary collapse
-
#after_create_exception_callbacks ⇒ Array<Proc>
readonly
Callbacks after the exception is created.
-
#before_create_exception_callbacks ⇒ Array<Proc>
readonly
Callbacks before the exception is created.
-
#github_api_token ⇒ String
Github token to make API calls with.
-
#github_user_name ⇒ String
Github username for the user account that will make the API calls.
-
#ignored_exceptions ⇒ Array<String>
Exception types as strings of the message to ignore.
-
#logger ⇒ Logger
Logger to send output messages to.
-
#repo_name ⇒ String
Name of the Github repository.
-
#repo_owner ⇒ String
Name of the user or organization that hosts the repository.
-
#reporting_environments ⇒ Array<Symbol>
Environments to send exceptions from.
-
#send_all_exceptions ⇒ Boolean
If true, sends all exceptions to Github including duplicates.
Instance Method Summary collapse
- #after_create_exception(&block) ⇒ Object
- #before_create_exception(&block) ⇒ Object
-
#configure {|config| ... } ⇒ Object
(also: #config)
Provides configuration block for ExceptionHub.
- #define_defaults ⇒ Object
Instance Attribute Details
#after_create_exception_callbacks ⇒ Array<Proc> (readonly)
Returns Callbacks after the exception is created.
32 33 34 |
# File 'lib/exception_hub/configuration.rb', line 32 def after_create_exception_callbacks @after_create_exception_callbacks end |
#before_create_exception_callbacks ⇒ Array<Proc> (readonly)
Returns Callbacks before the exception is created.
36 37 38 |
# File 'lib/exception_hub/configuration.rb', line 36 def before_create_exception_callbacks @before_create_exception_callbacks end |
#github_api_token ⇒ String
Returns Github token to make API calls with.
28 29 30 |
# File 'lib/exception_hub/configuration.rb', line 28 def github_api_token @github_api_token end |
#github_user_name ⇒ String
Returns Github username for the user account that will make the API calls.
16 17 18 |
# File 'lib/exception_hub/configuration.rb', line 16 def github_user_name @github_user_name end |
#ignored_exceptions ⇒ Array<String>
Returns Exception types as strings of the message to ignore.
40 41 42 |
# File 'lib/exception_hub/configuration.rb', line 40 def ignored_exceptions @ignored_exceptions end |
#logger ⇒ Logger
Returns Logger to send output messages to.
48 49 50 |
# File 'lib/exception_hub/configuration.rb', line 48 def logger @logger end |
#repo_name ⇒ String
Returns Name of the Github repository.
12 13 14 |
# File 'lib/exception_hub/configuration.rb', line 12 def repo_name @repo_name end |
#repo_owner ⇒ String
Returns Name of the user or organization that hosts the repository.
20 21 22 |
# File 'lib/exception_hub/configuration.rb', line 20 def repo_owner @repo_owner end |
#reporting_environments ⇒ Array<Symbol>
Returns Environments to send exceptions from.
44 45 46 |
# File 'lib/exception_hub/configuration.rb', line 44 def reporting_environments @reporting_environments end |
#send_all_exceptions ⇒ Boolean
Returns If true, sends all exceptions to Github including duplicates.
24 25 26 |
# File 'lib/exception_hub/configuration.rb', line 24 def send_all_exceptions @send_all_exceptions end |
Instance Method Details
#after_create_exception(&block) ⇒ Object
73 74 75 |
# File 'lib/exception_hub/configuration.rb', line 73 def after_create_exception(&block) @after_create_exception_callbacks << block if block end |
#before_create_exception(&block) ⇒ Object
77 78 79 |
# File 'lib/exception_hub/configuration.rb', line 77 def before_create_exception(&block) @before_create_exception_callbacks << block if block end |
#configure {|config| ... } ⇒ Object Also known as: config
Provides configuration block for ExceptionHub
58 59 60 61 62 |
# File 'lib/exception_hub/configuration.rb', line 58 def configure define_defaults yield(self) if block_given? true end |
#define_defaults ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/exception_hub/configuration.rb', line 65 def define_defaults @after_create_exception_callbacks ||= [] @before_create_exception_callbacks ||= [] @ignored_exceptions ||= IGNORED_EXCEPTIONS_DEFAULT.dup @reporting_environments ||= [:production] @logger ||= defined?(::Rails) && ::Rails.logger || Logger.new(STDOUT) end |