Support Class Library
A set of tools providing classes and utility
InvalidEitherAccess.h
Go to the documentation of this file.
1 #pragma once
3 #include <scl/macros.h>
4 
5 namespace scl{
6  namespace exceptions{
11  public:
13  realConst(char*) type() const noexcept override{
14  return "scl::exceptions::InvalidEitherAccess";
15  }
16 
22  return InvalidEitherAccess{"Tried to access Lhs member of Either<Lhs, Rhs> when Rhs was set"};
23  }
24 
30  return InvalidEitherAccess{"Tried to access Rhs member of Either<Lhs, Rhs> when Lhs was set"};
31  }
32  };
33  }
34 }
Global namespace of the SCL.
Definition: alias.hpp:3
#define realConst(type)
Definition: macros.h:3
Exception(T &&reason)
Construct an scl::exceptions::Exception from an error message.
Definition: Exception.h:27
Base class for all regular exceptions.
Definition: Exception.h:12
static InvalidEitherAccess leftWhenRight()
Helper function that creates an InvaidEitherAccess when trying to access Lhs when Rhs is active...
static InvalidEitherAccess rightWhenLeft()
Helper function that creates an InvaidEitherAccess when trying to access Rhs when Lhs is active...
Exception class used when attempting to access the wrong type stored in an scl::utils::Either.
const char *const type() const noexcept override
A string describing the name of the exception class.