Skip to content

Commit e107ec2

Browse files
author
HD Moore
committed
Change fail to fail_with, fix typo
1 parent 74f6ff7 commit e107ec2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/auxiliary/admin/atg/atg_client.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize
1616
'Name' => 'Veeder-Root Automatic Tank Gauge (ATG) Administrative Client',
1717
'Description' => %q{
1818
This module acts as a simplistic administrative client for interfacing
19-
with Veeder-Root Automatic Tang Gauges (ATGs) or other devices speaking
19+
with Veeder-Root Automatic Tank Gauges (ATGs) or other devices speaking
2020
the TLS-250 and TLS-350 protocols. This has been tested against
2121
GasPot, a honeypot meant to simulate ATGs; it has not been tested
2222
against anything else, so use at your own risk.
@@ -170,12 +170,18 @@ def initialize
170170

171171
def setup
172172
# ensure that the specified command is implemented for the desired version of the TLS protocol
173-
fail "#{action.name} not defined for #{protocol}" unless action.opts.keys.include?(protocol_opt_name)
173+
unless action.opts.keys.include?(protocol_opt_name)
174+
fail_with(Failure::BadConfig, "#{action.name} not defined for #{protocol}")
175+
end
174176

175177
# ensure that the tank number is set for the commands that need it
176-
fail "TANK_NUMBER #{tank_number} is invalid" if action.name == 'SET_TANK_NAME' && (tank_number < 0 || tank_number > 99)
178+
if action.name == 'SET_TANK_NAME' && (tank_number < 0 || tank_number > 99)
179+
fail_with(Failure::BadConfig, "TANK_NUMBER #{tank_number} is invalid")
180+
end
177181

178-
fail "Invalid timeout #{timeout} -- must be > 0" unless timeout > 0
182+
unless timeout > 0
183+
fail_with(Failure::BadConfig, "Invalid timeout #{timeout} -- must be > 0")
184+
end
179185
end
180186

181187
def get_response(request)

0 commit comments

Comments
 (0)