Class: CleanArchitecture::Entities::FailureDetails

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/clean_architecture/entities/failure_details.rb

Constant Summary collapse

FailureTypes =
Types::Strict::String.enum(
  'error',
  'expectation_failed',
  'not_found',
  'unauthorized',
  'unprocessable_entity'
)

Class Method Summary collapse

Class Method Details

.from_array(array) ⇒ Object



22
23
24
# File 'lib/clean_architecture/entities/failure_details.rb', line 22

def self.from_array(array)
  new(message: array.map(&:to_s).join(', '), other_properties: {}, type: 'error')
end

.from_string(string) ⇒ Object



26
27
28
# File 'lib/clean_architecture/entities/failure_details.rb', line 26

def self.from_string(string)
  new(message: string, other_properties: {}, type: 'error')
end