# # $Id$ # # Copyright (c) 2009-2010 NetApp Inc. # All rights reserved. # ## @summary Provide an exception class that is a subclass of ## NATE::BaseException that will be thrown when there ## are HighAvailablity (HA) errors ## ## @author dl-nacl-dev@netapp.com ## @status Shared ## @pod here =head1 NAME NACL::Exceptions::HighAvailabilityError =head1 DESCRIPTION Used for errors associated with HighAvailabilty (HA). =head1 EXAMPLE use NACL::Exceptions::HighAvailabilityError qw(:try); try { NACL::STask::Node->get_partner(...); } catch NACL::Exceptions::HighAvailabilityError with { my $ex = shift; my $cs = $ex->state(); $Log->comment("HA error: ".$ex->text()); if ( $cs->enable() !~ /true/i ) { $Log->comment("HA is not enabled: ".$ex->text()); } }; # Example for throwing exception use NACL::Exceptions::HighAvailabilityError qw(:try); NACL::Exceptions::HighAvailabilityError->throw("HA not Enabled for filer $node", node => $node, ha_enabled => 0 ); =cut =head1 ATTRIBUTES These attributes are to record specific HA errors. C<< "node" => nodename >> Name of node. C<< "state" => component_state >> A NACL::CS::StorageFailover object reference. =cut package NACL::Exceptions::HighAvailabilityError; use base qw(NATE::BaseException); use Class::MethodMaker [ scalar => 'node', scalar => [ { -type => 'NACL::CS::StorageFailover' }, 'state', ] ]; sub new { my ( $self, $text, %args ) = @_; my $obj = $self->SUPER::new( $text, %args ); $obj->init(%args); return $obj; } ## end sub new sub init { my $self = shift; my %args = ( node => undef, state => undef, @_ ); $self->node( $args{node} ) if ( $args{node} ); $self->state( $args{state} ) if ( $args{state} ); } ## end sub init 1;