args-parser 6.3.3
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
31#ifndef ARGS__EXCEPTIONS_HPP__INCLUDED
32#define ARGS__EXCEPTIONS_HPP__INCLUDED
33
34// C++ include.
35#include <stdexcept>
36
37// Args include.
38#include "types.hpp"
39
40
41namespace Args {
42
43//
44// BaseException
45//
46
49 : public std::logic_error
50{
51public:
52 explicit BaseException( String what )
53 : std::logic_error( "Please use desc() method of the exception." )
54 , m_what( std::move( what ) )
55 {
56 }
57
58 virtual ~BaseException() noexcept
59 {
60 }
61
63 const String & desc() const noexcept
64 {
65 return m_what;
66 }
67
68private:
70 String m_what;
71}; // class BaseException
72
73
74//
75// HelpHasBeenPrintedException
76//
77
80 : public BaseException
81{
82public:
84 : BaseException( SL( "Help has been printed." ) )
85 {
86 }
87}; // class HelpHasBeenPrintedException
88
89} /* namespace Args */
90
91#endif // ARGS__EXCEPTIONS_HPP__INCLUDED
Base exception of the library.
virtual ~BaseException() noexcept
const String & desc() const noexcept
BaseException(String what)
This exception notifies about that help has been printed.
Definition api.hpp:42
std::string String
String type.
Definition types.hpp:324
#define SL(str)
Definition types.hpp:338