Skip to content

APIError not using pointer receiver #285

@amwill04

Description

@amwill04

APIError implementation of Error() does no use pointer receiver that while does not break errors.As it changes how you expect to use it.

_, err := db.w.Catalogs.GetByName(ctx, name)
if err != nil {
	var apiErr *apierr.APIError
	if errors.As(err, &apiErr)
            // This block is never called
	}
	return false, fmt.Errorf("catalogExists: %w", err)
}

I know that IsMissing is available to do this check but would seem better to have APIError work as expected.

Happy to open a PR if this is something that would be accepted

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