NAME

Ekorn::Pipeline::Errors - report Ekorn::Pipeline's errors at the caller's line

SYNOPSIS

use Ekorn::Pipeline::Errors qw(croakf);

our @CARP_NOT = @Ekorn::Pipeline::Errors::INTERNAL;

croakf 'Expected a count of 0 or more' unless $count =~ m( \A \d+ \z )xa;

DESCRIPTION

Ekorn::Pipeline reports its errors at the first line outside it, so its user sees the line of their own code that caused them. Nothing is exported by default.

croakf is for modules of stages outside Ekorn::Pipeline too, such as DBIx::Squirrel::Stages::Rows. Called from a function that makes a stage, it reports a mistake at the line that called the function, with nothing more to set up. A % in the message is written %%.

A module of functions that take stages from their callers can put @INTERNAL in its own @CARP_NOT, as in the synopsis. Then a stage that dies is reported at the caller's line, where the stage was written, not at the line in the module that ran the pipeline.

FUNCTIONS

croakf

croakf 'Expected stage #%d to be a stage, not a source', $n;

Croaks with a message made by sprintf from a format and its arguments, at the same line "croak" in Carp would report.

Write the format as a literal in the code. Values go in as arguments, through %s and the like, never in the format. A format made from data does whatever its % directives say: %999999999s makes a string of a gigabyte.

VARIABLES

@INTERNAL

The packages of Ekorn::Pipeline. Each of its modules that croaks uses this list as its @CARP_NOT, so Carp looks past all of them to the caller's line.

SEE ALSO

Ekorn::Pipeline, Carp

AUTHOR

Iain Campbell <cpanic@cpan.org>

LICENSE

Copyright (c) 2024-2026 by Iain Campbell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.