Add dlogf printf formatting, ipv4::to_string helper, clean up string building
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
@@ -32,8 +33,10 @@ void typed_handler(responder resp, std::span<const uint8_t> payload) {
|
||||
auto tup = req.as_tuple();
|
||||
auto r = msgpack::unpack(p, tup);
|
||||
if (!r) {
|
||||
resp.respond(DeviceError{1, "decode request ext_id=" +
|
||||
std::to_string(Req::ext_id) + ": msgpack error " + std::to_string(static_cast<int>(r.error()))});
|
||||
char err[64];
|
||||
snprintf(err, sizeof(err), "decode request ext_id=%d: msgpack error %d",
|
||||
Req::ext_id, static_cast<int>(r.error()));
|
||||
resp.respond(DeviceError{1, err});
|
||||
return;
|
||||
}
|
||||
auto result = Fn(resp, req);
|
||||
|
||||
Reference in New Issue
Block a user