Skip to content

Commit

Permalink
Merge bitcoin#22200: zmq: use std::string in zmqError()
Browse files Browse the repository at this point in the history
3f05a9e zmq: use msg: prefix over errno= in zmqError (fanquake)
9a7cb57 zmq: use std::string in zmqError() (fanquake)

Pull request description:

  This is two minor changes. The first is to change `zmqError` to take a `const std::string&` instead of a `const char*`. The second is to change the second portion of `zmqError` to print `msg: message` rather than `errno=message`, given that `zmq_strerror` returns a message. To me, this seems more readable / useful than output like: `Error: Unable to initialize context errno=No such file or directory`.

ACKs for top commit:
  practicalswift:
    cr ACK 3f05a9e
  instagibbs:
    utACK bitcoin@3f05a9e
  theStack:
    Code-Review ACK 3f05a9e

Tree-SHA512: 197cf381e8b3ced271d0e575e0c6d8e5e9ed93c4b284338b17873c5232eaabe64d6c4b66e1aeb5e76befc89e316abae2b28b7fd760f178481d7b9f4e3f85da67
  • Loading branch information
MarcoFalke committed Jun 9, 2021
2 parents 93e38d5 + 3f05a9e commit ca424e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/zmq/zmqutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#include <zmq/zmqutil.h>

#include <logging.h>

#include <zmq.h>

void zmqError(const char* str)
#include <cerrno>
#include <string>

void zmqError(const std::string& str)
{
LogPrint(BCLog::ZMQ, "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
LogPrint(BCLog::ZMQ, "zmq: Error: %s, msg: %s\n", str, zmq_strerror(errno));
}
4 changes: 3 additions & 1 deletion src/zmq/zmqutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BITCOIN_ZMQ_ZMQUTIL_H
#define BITCOIN_ZMQ_ZMQUTIL_H

void zmqError(const char* str);
#include <string>

void zmqError(const std::string& str);

#endif // BITCOIN_ZMQ_ZMQUTIL_H

0 comments on commit ca424e2

Please sign in to comment.