From ec0cf9262d2d4dd5025bb0f48f7b0097f3f40676 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 27 Apr 2026 15:00:15 +0200 Subject: [PATCH] jfjoch_broker: remove httplib error handler, which was overwriting error status codes --- broker/JFJochBrokerHttp.cpp | 8 ++++---- docs/CHANGELOG.md | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index 959ff8e2..ec2d90bf 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -138,10 +138,6 @@ std::pair JFJochBrokerHttp::handleOperationException(const std void JFJochBrokerHttp::attach(httplib::Server &server) { register_routes(server); - server.set_error_handler([](const httplib::Request &, httplib::Response &res) { - res.status = 404; - res.set_content("The requested method does not exist", "text/plain"); - }); } void JFJochBrokerHttp::register_routes(httplib::Server &server) { @@ -399,6 +395,8 @@ void JFJochBrokerHttp::wait_until_running_post(const std::optional &tim else status = state_machine.WaitTillNotBusy(std::chrono::seconds(timeout.value())); + logger.Info("Wait until running"); + switch (status.state) { case JFJochState::Measuring: response.status = 200; @@ -429,6 +427,8 @@ void JFJochBrokerHttp::wait_till_done_post(const std::optional &timeout else status = state_machine.WaitTillMeasurementDone(std::chrono::seconds(timeout.value())); + logger.Info("Wait till done"); + switch (status.state) { case JFJochState::Idle: response.status = 200; diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e5f50b1c..dbb8d9b1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,7 +6,8 @@ This is an UNSTABLE release. The release has significant modifications and bug f * jfjoch_broker: Cleanup DECTRIS start-up code to enable a shorter start time * jfjoch_broker: Allow for asynchronous start to allow overlapping detector configuration with other beamline preparations * jfjoch_broker: Goniometer axis name is converted to lowercase -* +* jfjoch_broker: Fix bug, where wrong HTTP error codes were returned + ### 1.0.0-rc.137 This is an UNSTABLE release. The release has significant modifications and bug fixes, if things go wrong, it is better to revert to 1.0.0-rc.132.