Skip to content

Use a well-defined constant Error Type(s) as Response Type #25

@mialbu

Description

@mialbu

Problem Statement

If there's an error, the response type is dependent on the exact error type. That means, the error type could be more or less arbitrary, e.g., fmt.wrapError, fmt.Error, or others. The specific type of the error is not really useful and should be passed on in a more controlled manner along its message.

Context:

func Error(err error) *PointerResponse {
return &PointerResponse{
reflectType: reflect.TypeOf(err),
data: []byte(err.Error()),
}
}

Solution Approach

The error type should be a well-defined constant value, so that the consumer of that response struct value can easily verify that it is an error.

If needed, there could still be a more granular approach that could include multiple well-defined constant error type values. The important part of this issue is, that the consumer of the shared-lib knows exactly which types of errors it has to deal with.

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