Skip to content

Commit ebc59a1

Browse files
committed
🐛 fix(exception): Remove overite of class base message
1 parent f911226 commit ebc59a1

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

include/libserial/serial_exception.hpp

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,73 +28,65 @@ const char* what() const noexcept override {
2828
}
2929
private:
3030
std::string message_;
31-
}; // class SerialException
31+
}; // class SerialException
3232

3333
/**
3434
* @class PortNotFoundException
3535
* @brief Exception class for port not found errors
36-
*
36+
*
3737
* The PortNotFoundException class is derived from SerialException
3838
* and is used to indicate that a specified serial port could not be found.
3939
*/
4040
class PortNotFoundException : public SerialException {
4141
public:
4242
explicit PortNotFoundException(std::string message)
43-
: SerialException(std::move(message)) {}
44-
const char* what() const noexcept override { return message_.c_str(); }
45-
private:
46-
std::string message_;
43+
: SerialException(std::move(message)) {
44+
}
4745
}; // class PortNotFoundException
4846

4947
/**
5048
* @class PermissionDeniedException
5149
* @brief Exception class for permission denied errors
52-
*
50+
*
5351
* The PermissionDeniedException class is derived from SerialException
5452
* and is used to indicate that permission to access a specified serial port was denied.
5553
*/
5654
class PermissionDeniedException : public SerialException {
5755
public:
5856
explicit PermissionDeniedException(std::string message)
59-
: SerialException(std::move(message)) {}
60-
const char* what() const noexcept override { return message_.c_str(); }
61-
private:
62-
std::string message_;
57+
: SerialException(std::move(message)) {
58+
}
6359
}; // class PermissionDeniedException
6460

6561
/**
6662
* @class TimeoutException
6763
* @brief Exception class for timeout errors
68-
*
64+
*
6965
* The TimeoutException class is derived from SerialException
7066
* and is used to indicate that a serial port operation has timed out.
7167
*/
7268
class TimeoutException : public SerialException {
7369
public:
7470
explicit TimeoutException(std::string message)
75-
: SerialException(std::move(message)) {}
76-
const char* what() const noexcept override { return message_.c_str(); }
77-
private:
78-
std::string message_;
71+
: SerialException(std::move(message)) {
72+
}
7973
}; // class TimeoutException
8074

8175
/**
8276
* @class IOException
8377
* @brief Exception class for I/O errors
84-
*
78+
*
8579
* The IOException class is derived from SerialException
8680
* and is used to indicate that an I/O error has occurred during
8781
* serial port operations.
8882
*/
8983
class IOException : public SerialException {
9084
public:
9185
explicit IOException(std::string message)
92-
: SerialException(std::move(message)) {}
93-
const char* what() const noexcept override { return message_.c_str(); }
94-
private:
95-
std::string message_;
86+
: SerialException(std::move(message)) {
87+
}
9688
}; // class IOException
9789

98-
}; // namespace libserial
90+
} // namespace libserial
9991

10092
#endif // INCLUDE_LIBSERIAL_SERIAL_EXCEPTION_HPP_

0 commit comments

Comments
 (0)