Wrapped the error module in a more C++-ish way

Added std::function capability, C-style function pointer capability,
Error class, and C++ style function pointers.
Updated examples