Initial version
This commit is contained in:
commit
04b878f078
28 changed files with 1771 additions and 0 deletions
114
example/include/process/process_exceptions.hpp
Normal file
114
example/include/process/process_exceptions.hpp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
#ifndef PROCESS_LIBPROCESS_INCLUDE_PROCESS_EXCEPTIONS_HPP
|
||||
#define PROCESS_LIBPROCESS_INCLUDE_PROCESS_EXCEPTIONS_HPP
|
||||
#include <stdexcept>
|
||||
|
||||
namespace process {
|
||||
/**
|
||||
Base class for all libprocess exceptions
|
||||
*/
|
||||
class ProcessException : public std::runtime_error {
|
||||
public:
|
||||
explicit ProcessException(const std::basic_string<char>& what) noexcept
|
||||
: std::runtime_error(what)
|
||||
{
|
||||
}
|
||||
|
||||
~ProcessException() override = default;
|
||||
ProcessException(ProcessException const&) = delete;
|
||||
ProcessException& operator=(ProcessException const&) & = delete;
|
||||
ProcessException(ProcessException&&) = delete;
|
||||
ProcessException& operator=(ProcessException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if something goes wrong during process creation
|
||||
*/
|
||||
class ProcessCreationException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessCreationException() override = default;
|
||||
ProcessCreationException(ProcessCreationException const&) = delete;
|
||||
ProcessCreationException& operator=(ProcessCreationException const&) & = delete;
|
||||
ProcessCreationException(ProcessCreationException&&) = delete;
|
||||
ProcessCreationException& operator=(ProcessCreationException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if something goes wrong while attempting to start a process
|
||||
*/
|
||||
class ProcessStartException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessStartException() override = default;
|
||||
ProcessStartException(ProcessStartException const&) = delete;
|
||||
ProcessStartException& operator=(ProcessStartException const&) & = delete;
|
||||
ProcessStartException(ProcessStartException&&) = delete;
|
||||
ProcessStartException& operator=(ProcessStartException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if something goes wrong while attempting to stop a process
|
||||
*/
|
||||
class ProcessStopException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessStopException() override = default;
|
||||
ProcessStopException(ProcessStopException const&) = delete;
|
||||
ProcessStopException& operator=(ProcessStopException const&) & = delete;
|
||||
ProcessStopException(ProcessStopException&&) = delete;
|
||||
ProcessStopException& operator=(ProcessStopException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if Process::start() is called but the process is already running
|
||||
*/
|
||||
class ProcessAlreadyStartedException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessAlreadyStartedException() override = default;
|
||||
ProcessAlreadyStartedException(ProcessAlreadyStartedException const&) = delete;
|
||||
ProcessAlreadyStartedException& operator=(ProcessAlreadyStartedException const&) & = delete;
|
||||
ProcessAlreadyStartedException(ProcessAlreadyStartedException&&) = delete;
|
||||
ProcessAlreadyStartedException& operator=(ProcessAlreadyStartedException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if Process::stop() is called but the process is already stopped
|
||||
*/
|
||||
class ProcessAlreadyStoppedException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessAlreadyStoppedException() override = default;
|
||||
ProcessAlreadyStoppedException(ProcessAlreadyStoppedException const&) = delete;
|
||||
ProcessAlreadyStoppedException& operator=(ProcessAlreadyStoppedException const&) & = delete;
|
||||
ProcessAlreadyStoppedException(ProcessAlreadyStoppedException&&) = delete;
|
||||
ProcessAlreadyStoppedException& operator=(ProcessAlreadyStoppedException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if the state of a process cannot be updated
|
||||
*/
|
||||
class ProcessUpdateException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessUpdateException() override = default;
|
||||
ProcessUpdateException(ProcessUpdateException const&) = delete;
|
||||
ProcessUpdateException& operator=(ProcessUpdateException const&) & = delete;
|
||||
ProcessUpdateException(ProcessUpdateException&&) = delete;
|
||||
ProcessUpdateException& operator=(ProcessUpdateException&&) & = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
Thrown if the termination of a process fails
|
||||
*/
|
||||
class ProcessTerminationException : public ProcessException {
|
||||
public:
|
||||
using ProcessException::ProcessException;
|
||||
~ProcessTerminationException() override = default;
|
||||
ProcessTerminationException(ProcessTerminationException const&) = delete;
|
||||
ProcessTerminationException& operator=(ProcessTerminationException const&) & = delete;
|
||||
ProcessTerminationException(ProcessTerminationException&&) = delete;
|
||||
ProcessTerminationException& operator=(ProcessTerminationException&&) & = delete;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue