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

NAME

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

SYNOPSIS

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

DESCRIPTION

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

METHODS

40       throw( @msg, [ \%params ])
41
42       This overrides throw() from Exception::Class to add a little syntactic
43       sugar. Instead of:
44
45        $exception_class->throw( message => 'This is my very long error message that I would like to pass',
46                                 param1  => 'Param1 value',
47                                 param2  => 'Param2 value' );
48
49       You can use:
50
51        $exception_class->throw( 'This is my very long error message ',
52                                 'that I would like to pass',
53                                 { param1 => 'Param1 value',
54                                   param2 => 'Param2 value' } );
55
56       And everything will work the same. Combined with the SHORTCUTS this
57       makes for very readable code:
58
59        workflow_error "Something went horribly, terribly, dreadfully, "
60                       "frightfully wrong: $@",
61                       { foo => 'bar' };
62
63       #=head3 condition_error
64
65       #=head3 configuration_error
66
67       #=head3 persist_error
68
69       #=head3 validation_error
70
71       #=head3 workflow_error
72

SHORTCUTS

74       Workflow::Exception - import using "workflow_error"
75
76       Workflow::Exception::Condition - import using "condition_error"
77
78       Workflow::Exception::Configuration - import using "configuration_error"
79
80       Workflow::Exception::Persist - import using "persist_error"
81
82       Workflow::Exception::Validation - import using "validation_error"
83

SEE ALSO

85       Exception::Class
86
88       Copyright (c) 2003-2004 Chris Winters. All rights reserved.
89
90       This library is free software; you can redistribute it and/or modify it
91       under the same terms as Perl itself.
92

AUTHORS

94       Chris Winters <chris@cwinters.com>
95
96
97
98perl v5.8.8                       2007-04-25            Workflow::Exception(3)
Impressum