diff options
-rw-r--r-- | src/state/activating_state.hpp | 8 | ||||
-rw-r--r-- | src/state/deactivating_state.hpp | 8 | ||||
-rw-r--r-- | src/state/initial_state.hpp | 23 |
3 files changed, 8 insertions, 31 deletions
diff --git a/src/state/activating_state.hpp b/src/state/activating_state.hpp index bd1688f..295d185 100644 --- a/src/state/activating_state.hpp +++ b/src/state/activating_state.hpp @@ -17,14 +17,12 @@ struct ActivatingState : public BasicStateT<ActivatingState> std::unique_ptr<BasicState> handleEvent(SubprocessStoppedEvent event); template <class AnyEvent> - std::unique_ptr<BasicState> handleEvent(AnyEvent event) - { + [[noreturn]] std::unique_ptr<BasicState> handleEvent(AnyEvent event) { LogMsg(Logger::Error, "Invalid event: ", event.eventName); - return nullptr; + throw sdbusplus::exception::SdBusError(EBUSY, "Resource is busy"); } - private: - std::unique_ptr<BasicState> activateProxyMode(); + private : std::unique_ptr<BasicState> activateProxyMode(); std::unique_ptr<BasicState> activateLegacyMode(); std::unique_ptr<BasicState> mountSmbShare(); std::unique_ptr<BasicState> mountHttpsShare(); diff --git a/src/state/deactivating_state.hpp b/src/state/deactivating_state.hpp index 7f3010a..0ad6f5b 100644 --- a/src/state/deactivating_state.hpp +++ b/src/state/deactivating_state.hpp @@ -49,14 +49,12 @@ struct DeactivatingState : public BasicStateT<DeactivatingState> } template <class AnyEvent> - std::unique_ptr<BasicState> handleEvent(AnyEvent event) - { + [[noreturn]] std::unique_ptr<BasicState> handleEvent(AnyEvent event) { LogMsg(Logger::Error, "Invalid event: ", event.eventName); - return nullptr; + throw sdbusplus::exception::SdBusError(EBUSY, "Resource is busy"); } - private: - std::unique_ptr<BasicState> evaluate() + private : std::unique_ptr<BasicState> evaluate() { if (udevStateChangeEvent && subprocessStoppedEvent) { diff --git a/src/state/initial_state.hpp b/src/state/initial_state.hpp index fecf2b6..f64ff25 100644 --- a/src/state/initial_state.hpp +++ b/src/state/initial_state.hpp @@ -134,17 +134,7 @@ struct InitialState : public BasicStateT<InitialState> timerPeriod](boost::asio::yield_context yield) { LogMsg(Logger::Info, "[App]: Unmount called on ", machine.getName()); - - try - { - machine.emitUnmountEvent(); - } - catch (const std::exception& e) - { - LogMsg(Logger::Error, e.what()); - throw sdbusplus::exception::SdBusError(EPERM, e.what()); - return false; - } + machine.emitUnmountEvent(); auto repeats = waitCnt; boost::asio::steady_timer timer(machine.getIoc()); @@ -174,16 +164,7 @@ struct InitialState : public BasicStateT<InitialState> interfaces::MountPointStateMachine& machine, std::optional<interfaces::MountPointStateMachine::Target> target) { - try - { - machine.emitMountEvent(std::move(target)); - } - catch (const std::exception& e) - { - LogMsg(Logger::Error, e.what()); - throw sdbusplus::exception::SdBusError(EPERM, e.what()); - return false; - } + machine.emitMountEvent(std::move(target)); auto repeats = waitCnt; boost::asio::steady_timer timer(machine.getIoc()); |