Sha256: 430853c4219b9089b29fe177d4739784d716728d71c274ca7c26ae6ff4719262
Contents?: true
Size: 1.44 KB
Versions: 4
Compression:
Stored size: 1.44 KB
Contents
# frozen_string_literal: true require_relative "ignoring_exception/exceptions" module ConvenientService module RSpec module PrimitiveHelpers module Classes class IgnoringException < Support::Command ## # @!attribute [r] exception # @return [StandardError] # attr_reader :exception ## # @!attribute [r] block # @return [Proc] # attr_reader :block ## # @param exception [StandardError] # @param block [Proc] # def initialize(exception, &block) @exception = exception @block = block end ## # @return [ConvenientService::Support::UniqueValue] # @raise [ConvenientService::RSpec::PrimitiveHelpers::Classes::IgnoringException::Exceptions::IgnoredExceptionIsNotRaised] # # @note Rescue `StandardError`, NOT `Exception`. # @see https://thoughtbot.com/blog/rescue-standarderror-not-exception # @see https://ruby-doc.org/core-2.7.0/StandardError.html # @see https://ruby-doc.org/core-2.7.0/Exception.html # def call block.call rescue exception Support::UNDEFINED else ::ConvenientService.raise Exceptions::IgnoredExceptionIsNotRaised.new(exception: exception) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems