EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CustomError Class Reference

Advanced version of UserError that allows to send a full custom message. More...

#include "PyExceptions.h"

Inheritance diagram for CustomError:
Collaboration diagram for CustomError:

Public Member Functions

 CustomError (const char *message,...)
 
- Public Member Functions inherited from UserError
 UserError (const char *exceptionType)
 
UserErrorAddFormatValue (const char *name, PyRep *value)
 Fluent version of the protected AddKeyword, allows for adding a keyword to the exception. More...
 
UserErrorAddDateTime (const char *name, time_t date)
 Shorthand method for adding the given date-time as a datetime string in the message. More...
 
UserErrorAddDate (const char *name, time_t date)
 Shorthand method for adding the given date time as a date string in the message. More...
 
UserErrorAddTime (const char *name, time_t time)
 Shorthand method for adding the given date time as a time string in the message. More...
 
UserErrorAddTimeShort (const char *name, time_t time)
 Shorthand method for adding the given time as a time string in the message (without minutes) More...
 
UserErrorAddA (const char *name, const char *value)
 Shorthand method for adding "a" before the beginning of the value. More...
 
UserErrorAddThe (const char *name, const char *value)
 Shorthand method for adding "the" before the beginning of the value. More...
 
UserErrorAddUELocalization (const char *name, const char *strKey, PyDict *args=nullptr)
 Shorthand method for adding a string in the client's translations. More...
 
UserErrorAddList (const char *name, PyList *listEntries, const char *separator=nullptr)
 Shorthand method for adding a list of format parameters. More...
 
UserErrorAddOwnerName (const char *name, uint32 ownerID)
 Shorthand method for adding an owner's name. More...
 
UserErrorAddOwnerNick (const char *name, uint32 ownerID)
 Shorthand method for adding an owner's nick (first name without surname) More...
 
UserErrorAddLocationName (const char *name, uint32 locationID)
 Shorthand method for adding a location's name. More...
 
UserErrorAddTypeName (const char *name, uint32 typeID)
 Shorthand method for adding a type's name. More...
 
UserErrorAddTypeDescription (const char *name, uint32 typeID)
 Shorthand method for adding a type's description. More...
 
UserErrorAddTypeList (const char *name, PyList *typeIDs)
 Shorthand method for adding a list of types' names. More...
 
UserErrorAddBlueprintTypeName (const char *name, uint32 bpTypeID)
 Shorthand method for adding a blueprint's type name. More...
 
UserErrorAddGroupName (const char *name, uint32 groupID)
 Shorthand method for adding a group's name. More...
 
UserErrorAddGroupDescription (const char *name, uint32 groupID)
 Shorthand method for adding a group's description. More...
 
UserErrorAddCategoryName (const char *name, uint32 categoryID)
 Shorthand method for adding a category's name. More...
 
UserErrorAddCategoryDescription (const char *name, uint32 categoryID)
 Shorthand method for adding a category's description. More...
 
UserErrorAddAmount (const char *name, int quantity)
 Shorthand method for adding a quantity value. More...
 
UserErrorAddAmount (const char *name, uint quantity)
 Shorthand method for adding a quantity value. More...
 
UserErrorAddAmount (const char *name, double quantity)
 Shorthand method for adding a quantity value. More...
 
UserErrorAddISK (const char *name, double isk)
 Shorthand method for adding an ISK amount. More...
 
UserErrorAddAUR (const char *name, double aur)
 Shorthand method for adding an AUR amount. More...
 
UserErrorAddDistance (const char *name, double distance)
 Shorthand method for adding distance in a easy to read unit. More...
 
UserErrorAddTypeIDAndQuantity (const char *name, uint32 typeID, int quantity)
 Shorthand method for adding type ID and quantity. More...
 
- Public Member Functions inherited from PyException
 PyException (PyRep *except)
 
 PyException (const PyException &oth)
 
 ~PyException ()
 
PyExceptionoperator= (const PyException &oth)
 

Static Private Attributes

static const char * EXCEPTION_NAME = "CustomError"
 

Additional Inherited Members

- Public Attributes inherited from PyException
PyRepssException
 
- Protected Member Functions inherited from UserError
void AddKeyword (const char *name, PyRep *value)
 Adds keyword to exception. More...
 
UserErrorAddParameterKeyword (const char *name, UserError_ParameterIDs type, PyRep *value, PyRep *value2=nullptr)
 Adds a keyword to exception. More...
 
PyDict_GetTupleKeywords () const
 
PyDict_GetDictKeywords () const
 
PyTuple_CreateArgs (const char *msg)
 
PyDict_CreateKeywords (const char *msg)
 
- Protected Attributes inherited from UserError
PyTuplem_args
 
PyDictm_keywords
 
- Static Protected Attributes inherited from UserError
static const char * EXCEPTION_NAME = "ccp_exceptions.UserError"
 

Detailed Description

Advanced version of UserError that allows to send a full custom message.

Shorthand version of UserError with fully customizable message

Author
almamu almam.nosp@m.u@al.nosp@m.mamu..nosp@m.com

Definition at line 453 of file PyExceptions.h.

Constructor & Destructor Documentation

CustomError::CustomError ( const char *  message,
  ... 
)

Initializes a CustomError with the given message

Parameters
[in]messageThe message to send to the client
[in]...Format arguments to the message

Definition at line 294 of file PyExceptions.cpp.

References UserError::AddFormatValue(), SafeFree(), and vasprintf().

296 {
297  va_list va;
298  va_start (va, fmt);
299 
300  char* str = nullptr;
301  vasprintf (&str, fmt, va);
302  assert (str);
303 
304  va_end (va);
305 
306  this->AddFormatValue ("error", new PyString (str));
307 
308  SafeFree (str);
309 }
Python string.
Definition: PyRep.h:430
UserError(const char *exceptionType)
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
int vasprintf(char **strp, const char *fmt, va_list ap)
Definition: eve-compat.cpp:70
void SafeFree(T *&p)
Frees and nullifies an array pointer.
Definition: SafeMem.h:111
static const char * EXCEPTION_NAME
Definition: PyExceptions.h:463

Here is the call graph for this function:

Member Data Documentation

const char * CustomError::EXCEPTION_NAME = "CustomError"
staticprivate

Definition at line 463 of file PyExceptions.h.


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