Skip to content

The error handling infrastructure

Felipe Aburaya edited this page Jan 20, 2017 · 2 revisions

Modern C++ recommends the use of exceptions to handle both logic and runtime errors. 3FD offers a robust infrastructure for error/exception handling which combines stack tracing, less code typing and low overhead. The stack tracing feature is optional for the sake of performance, but you probably want to use it at least in the testing phase.

The core of the error handling infrastructure is made of the AppException class and the stack tracer. When the client code instantiates an AppException, it packs information like a message, details, call stack trace, time, source file name and line number. When an exception is caught, you have this information to report just like in .NET. You can also choose to send it to the configured log output.

Sample of the log recorded by the framework:

2016-Oct-03 14:10:53 [process 12144] - DEBUG - 3FD has been initialized
2016-Oct-03 14:10:53 [process 12144] - NOTICE - RPC server 'TestClient3FD' will use protocol sequence 'ncalrpc'
2016-Oct-03 14:10:53 [process 12144] - NOTICE - Microsoft Active Directory is available and RPC server will attempt to use Kerberos authentication service
2016-Oct-03 14:10:53 [process 12144] - NOTICE - RPC server 'TestClient3FD' has been registered with Microsoft Negotiate SSP [SPN = efelabu@ERICSSON.SE]
2016-Oct-03 14:10:53 [process 12144] - NOTICE - Starting RPC server...
2016-Oct-03 14:10:53 [process 12144] - INFORMATION - Registering RPC server object A334E4CB-31CA-4C57-9B82-61720AE8EE83... done
2016-Oct-03 14:10:53 [process 12144] - INFORMATION - Registering RPC server object 3296A63C-D419-49C7-89E4-12F7247D2A72... done
2016-Oct-03 14:10:53 [process 12144] - INFORMATION - Registering RPC interface 1 with 2 objects... done
2016-Oct-03 14:10:53 [process 12144] - NOTICE - RPC server is listening
2016-Oct-03 14:10:54 [process 12144] - NOTICE - Shutting down RPC server...
2016-Oct-03 14:10:54 [process 12144] - NOTICE - RPC server was successfully shut down
2016-Oct-03 14:10:54 [process 12144] - DEBUG - 3FD was shutdown
2016-Oct-03 14:10:54 [process 12144] - DEBUG - 3FD has been initialized
2016-Oct-03 14:10:54 [process 12144] - DEBUG - 3FD was shutdown
2016-Oct-03 14:10:54 [process 12144] - DEBUG - 3FD has been initialized
2016-Oct-03 14:10:54 [process 12144] - ERROR - Property not supported by the device - OpenCL API: clCreateCommandQueue

### CALL STACK TRACE ###
$ tests_opencl.cpp (162) @ _3fd::integration_tests::Framework_OpenCL_TestCase_BufferRW_SyncOps_Test_Test::TestBody
$ opencl_impl_context.cpp (484) @ _3fd::opencl::Context::GetDevice
$ opencl_impl_device.cpp (114) @ _3fd::opencl::Device::Device

2016-Oct-03 14:10:54 [process 12144] - DEBUG - 3FD was shutdown
Clone this wiki locally