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::SystemData Class Reference

Exceptions caused by external call failures or invalid external data. Only classifies ones that can pass through the ABI. More...

#include <Exception.hpp>

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

Public Types

enum  ErrorCode : unsigned int {
  DIRECTORY_NOT_EMPTY, FILE_EXISTS, FILE_NOT_FOUND, STREAM_NOT_READABLE,
  STREAM_NOT_WRITABLE, HEAP_ALLOCATION_FAILURE, MUTEX_INITIALIZATION_FAILURE, PATH_LOST,
  PATH_TOO_LONG, STRING_VALIDATION_FAILURE, SYSTEM_PATH_RETRIEVAL_FAILURE, THREAD_CREATION_FAILURE
}
 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

 SystemData (const ErrorCode AErrorCode) noexcept
 Construct a SystemData 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 caused by external call failures or invalid external data. Only classifies ones that can pass through the ABI.

Definition at line 65 of file Exception.hpp.

Member Enumeration Documentation

The error code of the exception.

Enumerator
DIRECTORY_NOT_EMPTY 

Tried to delete a non-empty directory.

FILE_EXISTS 

A file that was to be created exists.

FILE_NOT_FOUND 

A required file was not found in the filesystem.

STREAM_NOT_READABLE 

Generic error for read failures. See functions for further documentation.

STREAM_NOT_WRITABLE 

Generic error for write failures. See functions for further documentation.

HEAP_ALLOCATION_FAILURE 

A heap has no block large enough for a requested allocation and expansion failed.

MUTEX_INITIALIZATION_FAILURE 

Mutex could not be created.

PATH_LOST 

A previously valid path has become invalidated, most likely due to deletion.

PATH_TOO_LONG 

Attempted to use a path greater than the maximum allowed byte value.

STRING_VALIDATION_FAILURE 

A string could not be validated.

SYSTEM_PATH_RETRIEVAL_FAILURE 

A system path could not be retrieved.

THREAD_CREATION_FAILURE 

Thread could not be created.

Definition at line 68 of file Exception.hpp.

68  : unsigned int {
70  FILE_EXISTS,
76  PATH_LOST,
81  };
Attempted to use a path greater than the maximum allowed byte value.
Definition: Exception.hpp:77
A required file was not found in the filesystem.
Definition: Exception.hpp:71
A previously valid path has become invalidated, most likely due to deletion.
Definition: Exception.hpp:76
A heap has no block large enough for a requested allocation and expansion failed. ...
Definition: Exception.hpp:74
Generic error for read failures. See functions for further documentation.
Definition: Exception.hpp:72
A file that was to be created exists.
Definition: Exception.hpp:70
A system path could not be retrieved.
Definition: Exception.hpp:79
Tried to delete a non-empty directory.
Definition: Exception.hpp:69
Generic error for write failures. See functions for further documentation.
Definition: Exception.hpp:73

Constructor & Destructor Documentation

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

Construct a SystemData 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 86 of file CYBException.cpp.

86  :
87  Base(ErrorMessage(AErrorCode), AErrorCode, Level::SYSTEM_DATA)
88 {
89  FLastInstantiatedExceptionCode = AErrorCode;
90 }
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
static API::String::Static ErrorMessage(const ErrorCode AErrorCode) noexcept
Get the associated message for an exception.
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::SystemData::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 42 of file CYBException.cpp.

42  {
44  API::String::Static ErrorMessage;
45  switch (AErrorCode) {
47  ErrorMessage = API::String::Static(u8"Tried to delete a non-empty directory");
48  break;
49  case FILE_EXISTS:
50  ErrorMessage = API::String::Static(u8"Tried to exclusively create a file that exists");
51  break;
52  case FILE_NOT_FOUND:
53  ErrorMessage = API::String::Static(u8"A required file was not found.");
54  break;
56  ErrorMessage = API::String::Static(u8"Generic error for read failures. See functions for further documentation");
57  break;
59  ErrorMessage = API::String::Static(u8"Generic error for write failures. See functions for further documentation");
60  break;
62  ErrorMessage = API::String::Static(u8"Current heap has no block large enough for a requested allocation and expansion failed");
63  break;
65  ErrorMessage = API::String::Static(u8"Failed to initialize a new mutex.");
66  break;
67  case PATH_LOST:
68  ErrorMessage = API::String::Static(u8"Path has become invalidated, most likely due to deletion");
69  break;
70  case PATH_TOO_LONG:
71  ErrorMessage = API::String::Static(u8"Attempted to use a path greater than the maximum allowed byte value");
72  break;
74  ErrorMessage = API::String::Static(u8"A string could not be validated");
75  break;
77  ErrorMessage = API::String::Static(u8"A system path could not be retrieved");
78  break;
80  ErrorMessage = API::String::Static(u8"OS failed to create requested thread.");
81  break;
82  }
83  return ErrorMessage;
84 }
Attempted to use a path greater than the maximum allowed byte value.
Definition: Exception.hpp:77
A required file was not found in the filesystem.
Definition: Exception.hpp:71
A previously valid path has become invalidated, most likely due to deletion.
Definition: Exception.hpp:76
static API::String::Static ErrorMessage(const ErrorCode AErrorCode) noexcept
Get the associated message for an exception.
A heap has no block large enough for a requested allocation and expansion failed. ...
Definition: Exception.hpp:74
Generic error for read failures. See functions for further documentation.
Definition: Exception.hpp:72
A file that was to be created exists.
Definition: Exception.hpp:70
static void LessThanOrEqual(const AType &ALHS, const AType &ARHS) noexcept
Less than or equal assertion function. May not be evaluated.
A system path could not be retrieved.
Definition: Exception.hpp:79
Tried to delete a non-empty directory.
Definition: Exception.hpp:69
Generic error for write failures. See functions for further documentation.
Definition: Exception.hpp:73

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