Files
gitlabhq/lib/gitlab/fp/unmatched_result_error.rb
2024-07-18 06:23:23 +00:00

17 lines
433 B
Ruby

# frozen_string_literal: true
module Gitlab
module Fp
class UnmatchedResultError < RuntimeError
# @param [Gitlab::Fp::Result] result
# @return [void]
def initialize(result:)
msg = "Failed to pattern match #{result.ok? ? "'ok'" : "'err'"} Result " \
"containing message of type: #{(result.ok? ? result.unwrap : result.unwrap_err).class.name}"
super(msg)
end
end
end
end