Module: Rwc::Core::Concerns::ErrorHandling::Validatable

Included in:
BaseService
Defined in:
lib/rwc/core/concerns/error_handling.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Includes core error handling functionality and class methods.

Parameters:

  • base (Class)

    The class to include the module in.



68
69
70
71
# File 'lib/rwc/core/concerns/error_handling.rb', line 68

def self.included(base)
  base.include(Core)
  base.extend(ClassMethods)
end

Instance Method Details

#raise_error!(message) ⇒ Object

Raises a service error with the specified message.

Parameters:

  • message (String)

    The error message to raise.

Raises:

  • (BaseService::ServiceError)

    The raised error.



77
78
79
# File 'lib/rwc/core/concerns/error_handling.rb', line 77

def raise_error!(message)
  raise ServiceError, message
end

#should_run_checks?Boolean

Checks if validation checks should be performed.

Returns:

  • (Boolean)

    True if checks should be performed; otherwise, false.



61
62
63
# File 'lib/rwc/core/concerns/error_handling.rb', line 61

def should_run_checks?
  self.class.should_run_checks
end