logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Message::Passing::Role::HasErrorChain - A role for components which can report errors

Description

       Some components can create an error stream in addition to a message stream.

Methods

error
       An attribute containing the error chain.

       By default, this is a chain of:

       Message::Passing::Filter::Encoder::JSON
       Message::Passing::Output::STDOUT

Name

       Message::Passing::Role::HasErrorChain - A role for components which can report errors

Sponsorship

       This  module exists due to the wonderful people at Suretec Systems Ltd.  <http://www.suretecsystems.com/>
       who sponsored its development for its VoIP division called SureVoIP <http://www.surevoip.co.uk/> for  use
       with the SureVoIP API - <http://www.surevoip.co.uk/support/wiki/api_documentation>

Synopsis

           # Note this is an example package, and does not really exist!
           package Message::Passing::Output::ErrorAllMessages;
           use Moo;
           use namespace::clean -except => 'meta';

           with qw/
               Message::Passing::Role::Output
               Message::Passing::Role::HasErrorChain
           /;

           sub consume {
               my ($self, $message) = @_;
               $self->error->consume($message);
           }

Warnings

ERRORCHAINSCANLOOP
       If  you  override  the  error chain output, be sure that the error chain does not go into your normal log
       path! This is because if you suddenly have errors in your normal log path, and  you  then  start  logging
       these errors, this causes more errors - causing you to generate a message loop.

   ENCODINGINERRORCHAINS
       If  you  emit  something which cannot be encoded to an error chain then the encoding error will likely be
       emitted by the error chain - this can again cause loops and other issues.

       All components which use error chains should be very careful to  output  data  which  they  are  entirely
       certain will be able to be encoded.

See Also