Skip to content

Commit f1c279a

Browse files
committed
✨ feat(ports): Implemented scanPorts no file or directory exception
1 parent 31eb26c commit f1c279a

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

include/libserial/ports.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ Ports() = default;
5050
* @brief Scans the system for available serial ports
5151
*
5252
* @return uint16_t The number of serial ports found
53-
* @throws SerialException if scanning fails
5453
* @throws SerialException if no ports are found
55-
* @throws PermissionDeniedException if insufficient permissions
5654
*/
5755
uint16_t scanPorts();
5856

src/ports.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ uint16_t Ports::scanPorts() {
2626
const char* by_id_dir = kSysSerialByIdPath;
2727
DIR* dir = opendir(by_id_dir);
2828
if (!dir) {
29-
std::cout << "No serial devices directory: " << by_id_dir << "\n";
30-
return -1;
29+
throw SerialException("Error while reading " + std::string(by_id_dir) + ": " + strerror(errno));
3130
}
3231

3332
// The POSIX directory-entry structure used by readdir() to describe files

0 commit comments

Comments
 (0)