HomeManualTopicsTypesSymbols

Errors

Description

In Funky errors are handled via so-called error objects.

In the case an error occurs:

  • if a function would return a single value, it returns an error object instead

  • if a function would return several values, it returns the expected number of results, replacing each result with the error object

  • if a function would return no value at all, it will return a single error object to its caller, which results in an error in the caller and leads to propagation of the error

    Error objects can contain only very few and special methods. Any attempt to access other methods will propagate the error.

    To check whether a value is an error object or not, use std::is_an_error.

    Example

    load $buf filename on buf.is_an_error: Error " Could not load file "@(filename)"!
    std::Error displays an error message and terminates the program
    std::check checks its argument
    std::errno_of retrieves the errno value of the error object
    std::error_category_of retrieves the error category of the error object
    std::error_check raises an error if any of its arguments is an error object
    std::error_details_of retrieves the error details of the error object
    std::error_message_text_of retrieves the error message text of the error object
    std::is_an_error returns true if the argument denotes an error-object
    std::try recover an error object
    std_types::error the prototype object for all error objects
    std_types::error.std::is_an_error error objects are errors
    std_types::error/std::error_category_of returns the error category of the error object
    std_types::error/std::error_details_of returns the error details of the error object
    std_types::error/std::error_message_text_of returns the error message text of the error object
    std_types::object.std::is_an_error objects are not errors by default
    std_types::undefined.std::is_an_error the special undefined object is not an error