Merge branch 'backport-system-check-fix' into 'master'
Make the SimpleExecutor rescue exceptions in the executing Checks See merge request !12487
This commit is contained in:
commit
dfad12ed0d
2 changed files with 26 additions and 0 deletions
|
@ -75,6 +75,8 @@ module SystemCheck
|
|||
|
||||
check.show_error
|
||||
end
|
||||
rescue StandardError => e
|
||||
$stdout.puts "Exception: #{e.message}".color(:red)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -75,6 +75,24 @@ describe SystemCheck::SimpleExecutor, lib: true do
|
|||
end
|
||||
end
|
||||
|
||||
class BugousCheck < SystemCheck::BaseCheck
|
||||
CustomError = Class.new(StandardError)
|
||||
set_name 'my bugous check'
|
||||
|
||||
def check?
|
||||
raise CustomError, 'omg'
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
@rainbow = Rainbow.enabled
|
||||
Rainbow.enabled = false
|
||||
end
|
||||
|
||||
after do
|
||||
Rainbow.enabled = @rainbow
|
||||
end
|
||||
|
||||
describe '#component' do
|
||||
it 'returns stored component name' do
|
||||
expect(subject.component).to eq('Test')
|
||||
|
@ -219,5 +237,11 @@ describe SystemCheck::SimpleExecutor, lib: true do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is an exception' do
|
||||
it 'rescues the exception' do
|
||||
expect{ subject.run_check(BugousCheck) }.not_to raise_exception
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue