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

The errors Ekorn::Pipeline raises are reported at the first line outside it, so its user sees the line of their own 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, in a package of its own, it reports a mistake at the line that called the function, with no more 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, so that a stage that dies is reported at its caller's line, where the stage was written, rather than at the module's own line that ran the pipeline.

FUNCTIONS

croakf

croakf 'Expected stage #%d to be a code reference', $n;

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

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

VARIABLES

@INTERNAL

The packages of Ekorn::Pipeline. Each of its modules that croaks takes this list as its @CARP_NOT, so that 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.