/* Copyright (c) 2015 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #ifndef _LEAN_EXCEPTION_H #define _LEAN_EXCEPTION_H #ifdef __cplusplus extern "C" { #endif LEAN_DEFINE_TYPE(lean_exception); /** \brief Delete an exception object allocated by Lean. This is a NOOP if \c e is null. */ void lean_del_exception(lean_exception e); /** \brief Return basic string/message describing the exception. \remark The string must be deallocated using #lean_del_string. \remark After we define the Lean environment object, we can provide richer messages. \remark The result is null if the operation failed or \c e is null. */ char const * lean_get_exception_message(lean_exception e); typedef enum { LEAN_NULL_EXCEPTION, // null (aka there is no exception) LEAN_SYSTEM_EXCEPTION, // exception generated by the C++ runtime LEAN_OUT_OF_MEMORY, // out of memory exception LEAN_INTERRUPTED, // execution was interrupted by user request LEAN_KERNEL_EXCEPTION, // type checking error LEAN_OTHER_EXCEPTION // other (TODO) lean exceptions } lean_exception_kind; /** \brief Return the kind of the given exception. */ lean_exception_kind lean_get_exception_kind(lean_exception e); #ifdef __cplusplus }; #endif #endif