Exception: Servus::Events::Errors::AnonymousServiceError
- Defined in:
- lib/servus/events/errors.rb
Overview
Raised when a service has no name, so no job class can be generated for it.
ActiveJob resolves a job on the worker by its serialized class name, so a
service created with Class.new(Servus::Base) has nothing to serialize.
This surfaces almost exclusively in tests — assign the class to a constant,
or use stub_const.
Class Method Summary collapse
Class Method Details
.for(service) ⇒ AnonymousServiceError
46 47 48 49 50 51 52 |
# File 'lib/servus/events/errors.rb', line 46 def self.for(service) new( "Cannot generate a job class for #{service.inspect}: it is anonymous. " \ 'ActiveJob resolves jobs by class name, so a service must be assigned ' \ 'to a constant before it can be enqueued.' ) end |