Support Class Library
A set of tools providing classes and utility
InvalidResultAccess.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::InvalidResultAccess";
15  }
16 
22  return InvalidResultAccess{"Tried to access value member of an error Result<T, E>"};
23  }
24 
30  return InvalidResultAccess{"Tried to access error member of a success Result<T, E>"};
31  }
32  };
33  }
34 }
static InvalidResultAccess okWhenErr()
Helper function that creates an InvalidResultAccess when trying to access Ok when Err...
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
Exception class used when attempting to access the wrong type stored in an scl::utils::Either.
Base class for all regular exceptions.
Definition: Exception.h:12
static InvalidResultAccess errWhenOk()
Helper function that creates an InvalidResultAccess when trying to access Err when Ok is active...
const char *const type() const noexcept override
A string describing the name of the exception class.