Skip to content

Cause() vs RootCause() #18

@ash2k

Description

@ash2k

I just came across this package and wondering why package's Cause() function returns the root cause and not just the cause of the passed error value?
I can imagine a situation where I want to inspect the cause of the error and check for some additional information in it, etc. So, to get that information I'll have to do a check for Cause() presence myself, call it, do a type check for additional information methods and only then call them. An additional method that returns the cause might be useful here.

ps. I wonder why this is not part of the standard library. Seems to be a very useful pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions