Skip to content

errors.As with a value target never matches SourceError/ProcessorError #91

Description

@MasterOfBinary

The engine emits pointer errors (batch/batch.go:385,427,433):

b.errs <- &SourceError{Err: err}
b.errs <- &ProcessorError{Err: err}

but the godoc on Batch says errors "will be of type SourceError / ProcessorError" (batch/batch.go:42,82), so the natural user code

var pe batch.ProcessorError
if errors.As(err, &pe) { ... }

silently never matches — *ProcessorError is not assignable to ProcessorError. Every error classifies as "other".

Fix options (decide once, before the v1 freeze):

  1. Commit to pointer identity: pointer receivers on Error/Unwrap, document the errors.As(err, &target) pointer-target form everywhere.
  2. Ship IsSourceError(err) / IsProcessorError(err) helpers and steer docs to those.

PRs #65/#68 add doc clarifications only; the type-identity decision is design work that belongs with the error-plane redesign (#79, #87).

Found in the 2026-07-10 full-repo review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions