ErrorHandling.rst edited online with Bitbucket: It seems we need to use 'sourcecode' rather than 'code-block' to make the code show up in the BitBucket preview.
This commit is contained in:
@ -9,7 +9,7 @@ PolyVox has a simple logging mechanism which allows it to write messages with an
|
||||
|
||||
The following functions are called at various points in the PolyVox codebase:
|
||||
|
||||
.. code-block :: c++
|
||||
.. sourcecode :: c++
|
||||
|
||||
void logDebug (const std::string& message);
|
||||
void logInfo (const std::string& message);
|
||||
@ -21,13 +21,13 @@ Fatal messages are only issued in non-recoverable scenarios when the application
|
||||
|
||||
PolyVox defines a LogHandler function pointer which looks like this:
|
||||
|
||||
.. code-block :: c++
|
||||
.. sourcecode :: c++
|
||||
|
||||
typedef void (*LogHandler)(const std::string& message, LogLevel logLevel);
|
||||
|
||||
There is a function called 'defaultLogHandler()' which matches this signature and writes the messages to cout/cerr (note that it suppresses Debug messages). To redirect log messages you can write your own fuction which matches this signature and the apply it with setLogHandler:
|
||||
|
||||
.. code-block :: c++
|
||||
.. sourcecode :: c++
|
||||
|
||||
setLogHandler(&myLogHandler);
|
||||
|
||||
@ -45,9 +45,3 @@ Most functions in PolyVox will validate their input parameters and throw an exce
|
||||
The most notable example of this is when accessing volume data through the get/setVoxel() functions, as these are designed to be very fast. Validating an input position would require multiple conditional operations which we chose to avoid. Therefore, **accessing a voxel outside of a volume will cause undefined behaviour.** When reading voxels it is safer to use the function getVoxelWithWrapping() as this lets you specify how out-of-bounds voxels should be handled.
|
||||
|
||||
In addition to the C++ exception handling mechanism, PolyVox also makes use of assertions to verify the internal state of the library at various points. If you hit an assert in PolyVox then there is a good chance it is a bug in the library, as user errors should have been prevented by throwing an exceptions.
|
||||
|
||||
.. sourcecode :: python
|
||||
|
||||
def wiki_rocks(text):
|
||||
formatter = lambda t: "funky"+t
|
||||
return formatter(text)
|
Reference in New Issue
Block a user