validation-error.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_V2_VALIDATION_ERROR_HPP
23 #define NDN_SECURITY_V2_VALIDATION_ERROR_HPP
24 
25 #include "../../common.hpp"
26 
27 namespace ndn {
28 namespace security {
29 namespace v2 {
30 
35 {
36 public:
41  enum Code : uint32_t {
42  NO_ERROR = 0,
53  USER_MIN = 256 // custom error codes should use >=256
54  };
55 
56 public:
60  ValidationError(uint32_t code, const std::string& info = "")
61  : m_code(code)
62  , m_info(info)
63  {
64  }
65 
66  uint32_t
67  getCode() const
68  {
69  return m_code;
70  }
71 
72  const std::string&
73  getInfo() const
74  {
75  return m_info;
76  }
77 
78 private:
79  uint32_t m_code;
80  std::string m_info;
81 };
82 
83 std::ostream&
84 operator<<(std::ostream& os, ValidationError::Code code);
85 
86 std::ostream&
87 operator<<(std::ostream& os, const ValidationError& error);
88 
89 } // namespace v2
90 } // namespace security
91 } // namespace ndn
92 
93 #endif // NDN_SECURITY_V2_VALIDATION_ERROR_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
Code
Known validation error code.
ValidationError(uint32_t code, const std::string &info="")
Validation error, implicitly convertible from an error code and info.
const std::string & getInfo() const
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &other)
Validation error code and optional detailed error message.