CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Static Private Member Functions | List of all members
CYB::Exception::Violation Class Reference

Exceptions indicating an API contract violation. Should not be anticipated. More...

#include <Exception.hpp>

Inheritance diagram for CYB::Exception::Violation:
Inheritance graph
[legend]
Collaboration diagram for CYB::Exception::Violation:
Collaboration graph
[legend]

Public Types

enum  ErrorCode : unsigned int {
  INVALID_ENUM, INVALID_INTEROP_CONSTRUCTOR, INVALID_OPERATION, INVALID_PARAMETERS,
  NEGATIVE_HEAP_ALLOCATION, UNSUPPORTED_ALLOCATION_AMOUNT
}
 The error code of the exception. More...
 
- Public Types inherited from CYB::Exception::Base
enum  Level : byte { Level::VIOLATION, Level::SYSTEM_DATA, Level::INTERNAL, Level::UNIT }
 The extended type of the exception. More...
 

Public Member Functions

 Violation (const ErrorCode AErrorCode) noexcept
 Construct a Violation exception. More...
 

Static Private Member Functions

static API::String::Static ErrorMessage (const ErrorCode AErrorCode) noexcept
 Get the associated message for an exception. More...
 

Additional Inherited Members

- Public Attributes inherited from CYB::Exception::Base
API::String::Static FMessage
 An english description of the error, guaranteed to be compatible with CYB::API::String::UTF8.
 
const unsigned int FErrorCode
 The assigned error code.
 
const Level FLevel
 The type of the exception.
 
- Protected Member Functions inherited from CYB::Exception::Base
 Base (API::String::Static &&AMessage, const unsigned int AErrorCode, const Level ALevel) noexcept
 Construct a Base exception. More...
 

Detailed Description

Exceptions indicating an API contract violation. Should not be anticipated.

Definition at line 32 of file Exception.hpp.

Member Enumeration Documentation

The error code of the exception.

Enumerator
INVALID_ENUM 

An operation was attempted with an invalid enum code.

INVALID_INTEROP_CONSTRUCTOR 

A contructor passed to the engine was malformed.

INVALID_OPERATION 

Illegal call given prexisting conditions.

INVALID_PARAMETERS 

The current arrangment of arguments passed the function is invalid.

NEGATIVE_HEAP_ALLOCATION 

An allocation was attempted with a negative size value.

UNSUPPORTED_ALLOCATION_AMOUNT 

An allocation was attempted with a size above 2047MB.

Definition at line 35 of file Exception.hpp.

35  : unsigned int {
36  INVALID_ENUM,
42  };
An allocation was attempted with a negative size value.
Definition: Exception.hpp:40
An allocation was attempted with a size above 2047MB.
Definition: Exception.hpp:41
The current arrangment of arguments passed the function is invalid.
Definition: Exception.hpp:39
A contructor passed to the engine was malformed.
Definition: Exception.hpp:37
Illegal call given prexisting conditions.
Definition: Exception.hpp:38
An operation was attempted with an invalid enum code.
Definition: Exception.hpp:36

Constructor & Destructor Documentation

CYB::Exception::Violation::Violation ( const ErrorCode  AErrorCode)
noexcept

Construct a Violation exception.

Parameters
AErrorCodeThe ErrorCode describing the exception
Thread Safety
This function requires no thread safety
Exceptions
CYB::Exception::ViolationError code: CYB::Exception::Violation::INVALID_EXCEPTION_CODE. Thrown if AErrorCode is not recognized by the engine
Attention
This function is for internal use only

Definition at line 36 of file CYBException.cpp.

36  :
37  Base(ErrorMessage(AErrorCode), AErrorCode, Level::VIOLATION)
38 {
39  FLastInstantiatedExceptionCode = AErrorCode;
40 }
static API::String::Static ErrorMessage(const ErrorCode AErrorCode) noexcept
Get the associated message for an exception.
thread_local unsigned int FLastInstantiatedExceptionCode
Used to better verify tests, should be optimized out by the linker. See: http://stackoverflow.com/questions/1229430/how-do-i-prevent-my-unused-global-variables-being-compiled-out.
Definition: CYBException.cpp:7
Base(API::String::Static &&AMessage, const unsigned int AErrorCode, const Level ALevel) noexcept
Construct a Base exception.

Member Function Documentation

CYB::API::String::Static CYB::Exception::Violation::ErrorMessage ( const ErrorCode  AErrorCode)
staticprivatenoexcept

Get the associated message for an exception.

Parameters
AErrorCodeThe ErrorCode describing the exception
Returns
A description of the exception indicated by AErrorCode
Thread Safety
This function requires no thread safety
Exceptions
CYB::Exception::ViolationError code: CYB::Exception::Violation::INVALID_EXCEPTION_CODE. Thrown if AErrorCode is not recognized by the engine

Definition at line 11 of file CYBException.cpp.

11  {
13  API::String::Static ErrorMessage;
14  switch (AErrorCode) {
15  case INVALID_ENUM:
16  ErrorMessage = API::String::Static(u8"An operation was attempted with an invalid enum code");
17  break;
19  ErrorMessage = API::String::Static(u8"An engine allocation was attempted with a malformed constructor");
20  break;
21  case INVALID_OPERATION:
22  ErrorMessage = API::String::Static(u8"An illegal call was made given prexisting conditions");
23  break;
24  case INVALID_PARAMETERS:
25  ErrorMessage = API::String::Static(u8"The current arrangment of arguments passed the function is invalid");
26  break;
28  ErrorMessage = API::String::Static(u8"Alloc or Realloc called with a negative size value");
29  break;
31  ErrorMessage = API::String::Static(u8"An allocation was attempted with a size greater than 2047MB");
32  break;
33  }
34  return ErrorMessage;
35 }
static API::String::Static ErrorMessage(const ErrorCode AErrorCode) noexcept
Get the associated message for an exception.
An allocation was attempted with a negative size value.
Definition: Exception.hpp:40
An allocation was attempted with a size above 2047MB.
Definition: Exception.hpp:41
The current arrangment of arguments passed the function is invalid.
Definition: Exception.hpp:39
A contructor passed to the engine was malformed.
Definition: Exception.hpp:37
Illegal call given prexisting conditions.
Definition: Exception.hpp:38
static void LessThanOrEqual(const AType &ALHS, const AType &ARHS) noexcept
Less than or equal assertion function. May not be evaluated.
An operation was attempted with an invalid enum code.
Definition: Exception.hpp:36

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