Skip to content

Export well-known errors and support errors.Is #5

@kpiljoong

Description

@kpiljoong

Current parse/validation functions likely return ad-hoc errors (string messages).

Proposal:

  • Define package-level error variables, e.g.:
    var (
      ErrInvalidPrefix    = errors.New("orderlyid: invalid prefix")
      ErrInvalidChecksum  = errors.New("orderlyid: invalid checksum")
      ErrInvalidFormat    = errors.New("orderlyid: invalid format")
    )
    
  • Use fmt.Errorf("%w: details", ErrInvalidPrefix) where needed.

Acceptance criteria:

  • Callers can use errors.Is(err, ErrInvalidChecksum) etc.
  • Documentations lists possible error values.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions