Logo white

Peter M. Groen / FlashMQ

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • FlashMQ
  • utils.h
  • bare start
    19f21bf2
    Wiebe Cazemier authored
    2020-12-03 22:15:43 +0100  
    Browse Code ยป
utils.h 286 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#ifndef UTILS_H
#define UTILS_H

#include <string.h>
#include <errno.h>
#include <string>

template<typename T> int check(int rc)
{
    if (rc < 0)
    {
        char *err = strerror(errno);
        std::string msg(err);
        throw T(msg);
    }

    return rc;
}

#endif // UTILS_H