Skip to content

Commit

Permalink
Fix specific exceptions not being caught (#255)
Browse files Browse the repository at this point in the history
### Public-Facing Changes

Fix specific exceptions not being caught

### Description
Fixes specific exceptions not being caught, leading to vague error
messages. This regression got introduced with #250.
  • Loading branch information
achim-k authored Jul 25, 2023
1 parent d992017 commit d78de15
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,15 @@ inline void Server<ServerConfiguration>::handleTextMessage(ConnHandle hdl, Messa
sendStatusAndLogMsg(hdl, StatusLevel::Error, "Unrecognized client opcode \"" + op + "\"");
break;
}
} catch (const ChannelError& e) {
sendStatusAndLogMsg(hdl, StatusLevel::Error, e.what());
} catch (const ExeptionWithId<uint32_t>& e) {
const std::string postfix = " (op: " + op + ", id: " + std::to_string(e.id()) + ")";
sendStatusAndLogMsg(hdl, StatusLevel::Error, e.what() + postfix);
} catch (const std::exception& e) {
const std::string postfix = " (op: " + op + ")";
sendStatusAndLogMsg(hdl, StatusLevel::Error, e.what() + postfix);
} catch (...) {
sendStatusAndLogMsg(hdl, StatusLevel::Error, op + ": Failed to execute handler");
const std::string postfix = " (op: " + op + ")";
sendStatusAndLogMsg(hdl, StatusLevel::Error, "Failed to execute handler" + postfix);
}
} // namespace foxglove

Expand Down

0 comments on commit d78de15

Please sign in to comment.