blob: 1d0db2aaf3efe4787b94d0608df8ab49d6e6aae6 [file] [log] [blame]
Jeff Thompsona92861a2013-10-16 14:06:23 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
9#ifndef NDN_DER_EXCEPTION_HPP
10#define NDN_DER_EXCEPTION_HPP
11
12#include <exception>
13#include <string>
14
15namespace ndn {
16
17namespace der {
18
19class DerException : public std::exception {
20public:
21 DerException(const std::string& errorMessage) throw();
22
23 ~DerException() throw();
24
25 std::string Msg() { return errorMessage_; }
26
27 virtual const char* what() const throw() { return errorMessage_.c_str(); }
28
29private:
30 const std::string errorMessage_;
31};
32
33class NegativeLengthException : public DerException
34{
35public:
36 NegativeLengthException(const std::string& errorMessage)
37 : DerException(errorMessage)
38 {}
39};
40
41class DerEncodingException : public DerException
42{
43public:
44 DerEncodingException(const std::string& errorMessage)
45 : DerException(errorMessage)
46 {}
47};
48
49class DerDecodingException : public DerException
50{
51public:
52 DerDecodingException(const std::string& errorMessage)
53 : DerException(errorMessage)
54 {}
55};
56
57} // der
58
59}
60
61#endif