Skip to content

common error strategy using an attribute macro #24

@matko

Description

@matko

The current error strategy is to implement IntoPrologException on the error results we wish to be able to convert into prolog errors using Context::try_or_die(..).

A common pattern that has emerged is that our error types tend to be enums, and the error terms we want to get out of those tend to be simple prolog functors that structure the enum data. Therefore, a common implementation of IntoPrologException tends to be a match on the error type, where for each match arm, a term! macro is used to build the resulting term.

It would be nice if this could be abstracted away using an attribute macro on the error enum instead, comparable to what the thiserror crate does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions