This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| functions:error [2016/08/10 10:27] – korshun | functions:error [2017/06/12 15:42] (current) – removed korshun | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Error notification ====== | ||
| - | |||
| - | Various functions can be used incorrectly. When this happens, you can put a print statement into the function. But will that print statement log to the server console in multiplayer? | ||
| - | |||
| - | To solve all these problems, ACSUtils provides a standardized error handling mechanism. Errors are triggered through a set of functions that pass them to your project' | ||
| - | |||
| - | < | ||
| - | #include " | ||
| - | function void ACSUtilsErrorHandler(int type, int message) | ||
| - | { | ||
| - | Log(s:" | ||
| - | printbold(s:" | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | The error handler can do whatever it wants with the messages: it can show them only to the administrator, | ||
| - | |||
| - | The error handler also receives the type of the error. There are the following error types: | ||
| - | |||
| - | * '' | ||
| - | * '' | ||
| - | * '' | ||
| - | |||
| - | ===== Error reporting functions ===== | ||
| - | |||
| - | To report errors, use one of the following functions, corresponding to each of the error types: | ||
| - | |||
| - | ==== ProgramError ==== | ||
| - | '' | ||
| - | |||
| - | Triggers an '' | ||
| - | |||
| - | ==== MappingError ==== | ||
| - | '' | ||
| - | |||
| - | Triggers an '' | ||
| - | |||
| - | ==== LimitError ==== | ||
| - | '' | ||
| - | |||
| - | Triggers an '' | ||
| - | |||
| - | ===== Custom error types ===== | ||
| - | |||
| - | To create a custom error type, just ''# | ||
| - | |||
| - | < | ||
| - | #define ACSERROR_MYCUSTOMERROR 1001 | ||
| - | |||
| - | function void CustomError(str message) | ||
| - | { | ||
| - | ACSUtilsErrorHandler(ACSERROR_MYCUSTOMERROR, | ||
| - | } | ||
| - | </ | ||