1
0
mirror of https://github.com/meineerde/rackstash.git synced 2026-02-01 01:37:12 +00:00

Add Flow#raise_on_error! as a convenience method

This commit is contained in:
Holger Just 2018-07-17 22:45:12 +02:00
parent e592434eec
commit f97bcf2334
2 changed files with 16 additions and 0 deletions

View File

@ -279,6 +279,14 @@ module Rackstash
raise_on_error?
end
# Set the {#raise_on_error} flag to true in order to re-raise any exceptions
# which occured during logging.
#
# @see raise_on_error
def raise_on_error!
self.raise_on_error = true
end
# @return [Bool] `true` if we re-raise any occured errors after logging them
# to the {#error_flow}. This can aid in debugging. By default, i.e., with
# {#raise_on_error?} being `false`, we swallow errors after logging them

View File

@ -374,6 +374,14 @@ RSpec.describe Rackstash::Flow do
end
end
describe '#raise_on_error!' do
it 'sets the flag to true' do
expect { flow.raise_on_error! }.to change { flow.raise_on_error? }
.from(false)
.to(true)
end
end
describe '#reopen' do
it 'calls adapter#reopen' do
expect(adapter).to receive(:reopen).and_return(true)