Added WebGUI::Error::Connection, and fixed docs

This commit is contained in:
JT Smith 2009-09-25 15:22:11 -05:00
parent 09358cbfe7
commit a34f584780

View file

@ -15,51 +15,6 @@ package WebGUI::Exception;
=cut
use strict;
use Exception::Class (
'WebGUI::Error' => {
description => "A general error occured.",
},
'WebGUI::Error::OverrideMe' => {
isa => 'WebGUI::Error',
description => 'This method should be overridden by subclasses.',
},
'WebGUI::Error::MethodNotFound' => {
isa => 'WebGUI::Error',
description => q|Called a method that doesn't exist.|,
fields => 'method'
},
'WebGUI::Error::InvalidObject' => {
isa => 'WebGUI::Error::InvalidParam',
description => "Expected to get a reference to an object type that wasn't gotten.",
fields => ["expected","got"],
},
'WebGUI::Error::InvalidParam' => {
isa => 'WebGUI::Error',
description => "Expected to get a param we didn't get.",
fields => ["param"],
},
'WebGUI::Error::ObjectNotFound' => {
isa => 'WebGUI::Error',
description => "The object you were trying to retrieve does not exist.",
fields => ["id"],
},
'WebGUI::Error::ObjectNotFound::Template' => {
isa => 'WebGUI::Error',
description => "The template an asset was trying to retrieve does not exist.",
fields => [qw/templateId assetId/],
},
'WebGUI::Error::InvalidFile' => {
isa => 'WebGUI::Error',
description => "The file you have provided has errors.",
fields => [qw{ brokenFile brokenLine }],
},
'WebGUI::Error::Template' => {
isa => 'WebGUI::Error',
description => "A template has errors that prevent it from being processed.",
},
);
=head1 NAME
@ -94,6 +49,11 @@ B<NOTE>: Though the package name is WebGUI::Exception, the handler objects that
These exception classes are defined in this class:
=cut
use Exception::Class (
#-------------------------------------------------------------------
=head2 WebGUI::Error
@ -123,6 +83,48 @@ A read only exception method that returns the line number where the exception wa
A read only exception method that returns the package name where the exception was thrown.
=cut
'WebGUI::Error' => {
description => "A general error occured.",
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::OverrideMe
An interface was not overriden as expected.
=cut
'WebGUI::Error::OverrideMe' => {
isa => 'WebGUI::Error',
description => 'This method should be overridden by subclasses.',
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::MethodNotFound
Tried calling a method that doesn't exist.
=head3 method
The method called.
=cut
'WebGUI::Error::MethodNotFound' => {
isa => 'WebGUI::Error',
description => q|Called a method that doesn't exist.|,
fields => 'method'
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::InvalidObject
Used when looking to make sure objects are passed in that you expect. ISA WebGUI::Error::InvalidParam.
@ -135,6 +137,17 @@ The type of object expected ("HASH", "ARRAY", "WebGUI::User", etc).
The object type we got.
=cut
'WebGUI::Error::InvalidObject' => {
isa => 'WebGUI::Error::InvalidParam',
description => "Expected to get a reference to an object type that wasn't gotten.",
fields => ["expected","got"],
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::InvalidParam
Used when an invalid parameter is passed into a subroutine.
@ -143,6 +156,17 @@ Used when an invalid parameter is passed into a subroutine.
Used to return the bad parameter, if present.
=cut
'WebGUI::Error::InvalidParam' => {
isa => 'WebGUI::Error',
description => "Expected to get a param we didn't get.",
fields => ["param"],
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::ObjectNotFound
Used when an object is trying to be retrieved, but does not exist. ISA WebGUI::Error.
@ -151,20 +175,98 @@ Used when an object is trying to be retrieved, but does not exist. ISA WebGUI::E
The id of the object to be retrieved.
=head2 WebGUI::Error::MethodNotFound
=cut
Tried calling a method that doesn't exist.
'WebGUI::Error::ObjectNotFound' => {
isa => 'WebGUI::Error',
description => "The object you were trying to retrieve does not exist.",
fields => ["id"],
},
=head3 method
The method called.
#-------------------------------------------------------------------
=head2 WebGUI::Error::OverrideMe
=head2 WebGUI::Error::ObjectNotFound::Template
An interface was not overriden as expected.
Used when a template is trying to be retrieved, but does not exist. ISA WebGUI::Error::ObjectNotFound.
=head3 templateId | id | assetId
The id of the object to be retrieved.
=cut
'WebGUI::Error::ObjectNotFound::Template' => {
isa => 'WebGUI::Error',
description => "The template an asset was trying to retrieve does not exist.",
fields => [qw/templateId assetId/],
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::InvalidFile
Used when accessing a file and there are formatting or data problems found in the file. ISA WebGUI::Error.
=head3 brokenFile
The filename.
=head3 brokenLine
The line the error was found on.
=cut
'WebGUI::Error::InvalidFile' => {
isa => 'WebGUI::Error',
description => "The file you have provided has errors.",
fields => [qw{ brokenFile brokenLine }],
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::Template
Used when a template has parsing errors. ISA WebGUI::Error.
=cut
'WebGUI::Error::Template' => {
isa => 'WebGUI::Error',
description => "A template has errors that prevent it from being processed.",
},
#-------------------------------------------------------------------
=head2 WebGUI::Error::Connection
Used when connecting to an external resource and it fails for some reason. ISA WebGUI::Error.
=head3 resource
The name or configuration or URL of the resource trying to be accessed.
=cut
'WebGUI::Error::Connection' => {
isa => 'WebGUI::Error',
description => "Couldn't establish a connection.",
fields => [qw{ resource }],
},
);
1;