date
a C++20 date library
Loading...
Searching...
No Matches
cgr::Date::DateError Class Reference

Exception thrown by the Date class. More...

#include <date.h>

Inheritance diagram for cgr::Date::DateError:

Public Types

enum class  Reason {
  INVALID_DAY , INVALID_MONTH , INVALID_YEAR , INVALID_DATE ,
  INVALID_FORMAT , OUT_OF_RANGE , EPOCH_FAILURE , LOGIC_ERROR ,
  SYSTEM_FAILURE
}
 Indicates the reason for a DateError exception. More...

Public Member Functions

 DateError (Reason reason, std::string message)
 Constructs a DateError from a reason and an error message.
const char * what () const noexcept override
 Returns the exception message.
Reason GetReason () const noexcept
 Returns the exception reason.

Detailed Description

Exception thrown by the Date class.

Member Enumeration Documentation

◆ Reason

enum class cgr::Date::DateError::Reason
strong

Indicates the reason for a DateError exception.

Enumerator
INVALID_DAY 

Day is out of valid range [1, 31].

INVALID_MONTH 

Month is out of valid range [1, 12].

INVALID_YEAR 

Year is out of valid range [MIN_YEAR, MAX_YEAR].

INVALID_DATE 

Invalid day/month/year combination.

INVALID_FORMAT 

Invalid date string format.

OUT_OF_RANGE 

Resulting date is out of [01/01/MIN_YEAR, 31/12/MAX_YEAR].

EPOCH_FAILURE 

Failed time_t conversion.

LOGIC_ERROR 

Logically invalid argument.

SYSTEM_FAILURE 

Failed system operation.

Constructor & Destructor Documentation

◆ DateError()

cgr::Date::DateError::DateError ( Reason reason,
std::string message )

Constructs a DateError from a reason and an error message.

Parameters
reasonThe exception reason.
messageThe error message.

Member Function Documentation

◆ what()

const char * cgr::Date::DateError::what ( ) const
nodiscardoverridenoexcept

Returns the exception message.

◆ GetReason()

Reason cgr::Date::DateError::GetReason ( ) const
nodiscardnoexcept

Returns the exception reason.


The documentation for this class was generated from the following file: