Add Readymade error inherited from StandardError. It should have an error_response method returning the Response object with failure or validation_fail status.
def call
build_record
build_form
return response(:validation_fail, errors: record.errors.messages) unless form_valid_and_sync?
assign_attributes
prepare_sequence
return sequence_error_response if sequence_error_response.present?
calculate_order_price
return calculate_order_response unless calculate_order_response.success?
build_hotel_product_items
success_response
rescue ReadymadeError => e
e.error_response # response(:failure, errors: data from error object)
end
Add Readymade error inherited from StandardError. It should have an error_response method returning the Response object with failure or validation_fail status.