Class: ProconBypassMan::DeviceConnection::Command
- Inherits:
-
Object
- Object
- ProconBypassMan::DeviceConnection::Command
- Defined in:
- lib/procon_bypass_man/device_connection/command.rb
Constant Summary collapse
- MAX_RETRY_COUNT =
3
Class Method Summary collapse
Class Method Details
.execute!(retry_count: 0) ⇒ void
This method returns an undefined value.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/procon_bypass_man/device_connection/command.rb', line 5 def self.execute!(retry_count: 0) begin gadget, procon = ProconBypassMan::DeviceConnection::Executer.execute! rescue ProconBypassMan::DeviceConnection::TimeoutErrorInConditionalRoute, ProconBypassMan::SafeTimeout::Timeout if retry_count >= MAX_RETRY_COUNT ProconBypassMan::SendErrorCommand.execute(error: "リトライしましたが、接続できませんでした") raise ProconBypassMan::DeviceConnection::TimeoutError else ProconBypassMan::SendErrorCommand.execute(error: "接続に失敗したのでリトライします") end retry_count = retry_count + 1 retry rescue ProconBypassMan::DeviceConnection::NotFoundProconError, ProconBypassMan::DeviceConnection::SetupIncompleteError => e raise end ProconBypassMan::DeviceConnection::PreBypass.new(gadget: gadget, procon: procon).execute! ProconBypassMan::DeviceConnection::ProconSettingOverrider.new(procon: procon).execute! return [gadget, procon] end |