Workflo...xception(3)

πŸ“¦
version 2.09 Β· 2 versions
, in fedora 44

πŸ’– Workflo...xception(3) β€” aka Workflow::Exception πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation, section 3, and the manual's short name is Workflo...xception(3) (yes the truncation is real, that's just how the header rolls). It's all about exception handling in Workflow. grab a boba, we're doing this πŸ§‹βœ¨


🌸 NAME 🌸

Workflow::Exception β€” the base class for workflow exceptions. mother of all the lil exception babies πŸ‘‘


✨ VERSION ✨

This documentation describes version 2.09 of this package. periodt πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

# Standard usage
use Workflow::Exception qw( workflow_error );

my $user = $wf->context->param( 'current_user' );
unless ( $user->check_password( $entered_password ) ) {
  workflow_error "User exists but password check failed";
}

# Pass a list of strings to form the message

unless ( $user->check_password( $entered_password ) ) {
  workflow_error 'Bad login: ', $object->login_attempted;
}

# Using other exported shortcuts

use Workflow::Exception qw( configuration_error );
configuration_error "Field 'foo' must be a set to 'bar'";

use Workflow::Exception qw( validation_error );
validation_error "Validation for field 'foo' failed: $error";

πŸ¦‹ DESCRIPTION πŸ¦‹

first things first bestie: you should probably go look at Exception::Class for more usage examples, why we even use exceptions, what they're intended for, all of that. it's giving prerequisite reading πŸ“š

so. this is the base class for all workflow exceptions. it declares a handful of exceptions and hands you shortcuts so that raising an exception is easier and way more readable. it's the glow-up your error handling deserved ✨


πŸ’… METHODS πŸ’…

throw( @msg, [ \%params ])

this one overrides throw() from Exception::Class to add a lil syntactic sugar. it's giving "let me make your life easier."

instead of this:

$exception_class->throw( message => 'This is my very long error message that I would like to pass',
                         param1  => 'Param1 value',
                         param2  => 'Param2 value' );

you can just do this:

$exception_class->throw( 'This is my very long error message ',
                         'that I would like to pass',
                         { param1 => 'Param1 value',
                           param2 => 'Param2 value' } );

and everything works the exact same way. no cap. and when you combine it with the SHORTCUTS, the code gets so readable:

workflow_error "Something went horribly, terribly, dreadfully, "
               "frightfully wrong: $@",
               { foo => 'bar' };

iconic behavior, honestly 🫢

configuration_error

this method transforms the error into a configuration error.

this exception is thrown via </mythrow> when configuration of a workflow is unsuccessful. πŸ’€

persist_error

this method transforms the error into a persistance error.

this exception is thrown via </mythrow> when the save of a workflow is unsuccessful.

validation_error

this method transforms the error into a validation error.

this exception is thrown via </mythrow> when input data or similar of a workflow is unsuccessful.

workflow_error

this method transforms the error into a workflow error.

this exception is thrown via </mythrow> when input data or similar of a workflow is unsuccessful.


🌈 SHORTCUTS 🌈

the whole point of these is that you import one lil name and get a whole exception class, iykyk:

  • Workflow::Exception β€” import using workflow_error
  • Workflow::Exception::Configuration β€” import using configuration_error
  • Workflow::Exception::Persist β€” import using persist_error
  • Workflow::Exception::Validation β€” import using validation_error

⭐ SEE ALSO ⭐

  • Exception::Class

Copyright (c) 2003-2021 Chris Winters. All rights reserved.

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

Please see the LICENSE πŸ“œ


πŸ’œ AUTHORS πŸ’œ

Please see Workflow


and that's the whole page, bestie! it was generated for perl v5.42.0 on 2026-01-17 β€” so if you're reading this way in the future, hi, hope the vibe check passed πŸ¦‹πŸ’– slay, go raise some exceptions responsibly ✨

πŸ“¦ where this page comes from