1Workflow::Exception(3)User Contributed Perl DocumentationWorkflow::Exception(3)
2
3
4

NAME

6       Workflow::Exception - Base class for workflow exceptions
7

VERSION

9       This documentation describes version 1.54 of this package
10

SYNOPSIS

12        # Standard usage
13        use Workflow::Exception qw( workflow_error );
14
15        my $user = $wf->context->param( 'current_user' );
16        unless ( $user->check_password( $entered_password ) ) {
17          workflow_error "User exists but password check failed";
18        }
19
20        # Pass a list of strings to form the message
21
22        unless ( $user->check_password( $entered_password ) ) {
23          workflow_error 'Bad login: ', $object->login_attempted;
24        }
25
26        # Using other exported shortcuts
27
28        use Workflow::Exception qw( configuration_error );
29        configuration_error "Field 'foo' must be a set to 'bar'";
30
31        use Workflow::Exception qw( validation_error );
32        validation_error "Validation for field 'foo' failed: $error";
33

DESCRIPTION

35       First, you should probably look at Exception::Class for more usage
36       examples, why we use exceptions, what they are intended for, etc.
37
38       This is the base class for all workflow exceptions. It declares a
39       handful of exceptions and provides shortcuts to make raising an
40       exception easier and more readable.
41

METHODS

43       throw( @msg, [ \%params ])
44
45       This overrides throw() from Exception::Class to add a little syntactic
46       sugar. Instead of:
47
48        $exception_class->throw( message => 'This is my very long error message that I would like to pass',
49                                 param1  => 'Param1 value',
50                                 param2  => 'Param2 value' );
51
52       You can use:
53
54        $exception_class->throw( 'This is my very long error message ',
55                                 'that I would like to pass',
56                                 { param1 => 'Param1 value',
57                                   param2 => 'Param2 value' } );
58
59       And everything will work the same. Combined with the SHORTCUTS this
60       makes for very readable code:
61
62        workflow_error "Something went horribly, terribly, dreadfully, "
63                       "frightfully wrong: $@",
64                       { foo => 'bar' };
65
66       condition_error
67
68       This method transforms the error to a condition error.
69
70       This exception is thrown via </mythrow> when a condition of a workflow
71       is invalid.
72
73       configuration_error
74
75       This method transforms the error to a configuration error.
76
77       This exception is thrown via </mythrow> when configuration of a
78       workflow is unsuccessful.
79
80       persist_error
81
82       This method transforms the error to a persistance error.
83
84       This exception is thrown via </mythrow> when the save of a workflow is
85       unsuccessful.
86
87       validation_error
88
89       This method transforms the error to a validation error.
90
91       This exception is thrown via </mythrow> when input data or similar of a
92       workflow is unsuccessful.
93
94       workflow_error
95
96       This method transforms the error to a workflow error.
97
98       This exception is thrown via </mythrow> when input data or similar of a
99       workflow is unsuccessful.
100

SHORTCUTS

102Workflow::Exception - import using "workflow_error"
103
104Workflow::Exception::Condition - import using "condition_error"
105
106Workflow::Exception::Configuration - import using
107           "configuration_error"
108
109Workflow::Exception::Persist - import using "persist_error"
110
111Workflow::Exception::Validation - import using "validation_error"
112

SEE ALSO

114       •   Exception::Class
115
117       Copyright (c) 2003-2021 Chris Winters. All rights reserved.
118
119       This library is free software; you can redistribute it and/or modify it
120       under the same terms as Perl itself.
121
122       Please see the LICENSE
123

AUTHORS

125       Please see Workflow
126
127
128
129perl v5.34.0                      2021-07-27            Workflow::Exception(3)
Impressum