Handle results in action handle methods

This commit is contained in:
2023-01-31 19:40:21 +11:00
parent 89f3d5387a
commit 8a54a584f2

View File

@@ -3,11 +3,17 @@
require "hanami/action" require "hanami/action"
require "httparty" require "httparty"
require "dry-monads"
require "dry-matcher"
require "dry/matcher/result_matcher"
module Adamantium module Adamantium
class Action < Hanami::Action class Action < Hanami::Action
include Deps["logger", "settings", not_found_view: "views.not_found"] include Deps["logger", "settings", not_found_view: "views.not_found"]
include Dry::Matcher.for(:handle, with: Dry::Matcher::ResultMatcher)
include Dry::Monads[:result]
handle_exception ROM::TupleCountMismatchError => :not_found handle_exception ROM::TupleCountMismatchError => :not_found
def authenticate!(req, res) def authenticate!(req, res)