# $Id: //depot/prod/test/nacldev/lib/NACL/Exceptions/CompareLunFailure.pm#1 $ # # Copyright (c) 2012 NetApp Inc. # All rights reserved. # ## @summary Provide an exception class that is a subclass of ## NATE::BaseException that will be thrown when verification of one ## or more field values does not match the provided value. ## ## @author sshaik@netapp.com, dl-nacl-dev@netapp.com ## @status Shared ## @pod here =head1 NAME NACL::Exceptions::CompareLunFailure =head1 DESCRIPTION This exception is thrown when verification of field values does not pass, i.e the field value for one or more fields does not match what was provided. =head1 ATTRIBUTES =head2 unexpected_values =over This is an array, which contains the hashref as its elements, the hashref will contains following as the key,value pair. "attribute" and the name of the field, on which mismatch ahs occurred, "lun1_value" and the first lun value of the field, "lun2_value" and second lun value of the field. =back =head3 Example format of "unexpected_values" =over $VAR1 = [ { 'lun1_value' => 'online', 'attribute' => 'state', 'lun2_value' => 'offline' }, { 'lun1_value' => '5242880', 'attribute' => 'size', 'lun2_value' => '4194304' } ]; =back =head2 missing_expected_mismatches =over This is an array-reference, which contains the hash with the keys denoting the fields whose values match when the mismatch is expected. =back =head3 Example Format of "missing_expected_mismatches" =over $VAR1 =[ { 'attribute' => 'serial', 'value' => 'C02BT$AtGxSY' } ]; =back =head1 EXAMPLE use NACL::Exceptions::CompareLunFailure qw(:try); try { $lun_obj->compare_luns(); } catch NACL::Exceptions::CompareLunFailure with { my $exception = shift; $Log->comment("Unexpected fields and their values: " . $exception->text()); my $unexpected_values = $exception->unexpected_values(); my $missing_expected_mismatches = $exception->missing_expected_mismatches(); }; =cut package NACL::Exceptions::CompareLunFailure; use base qw(NATE::BaseException); use Class::MethodMaker [ array => 'unexpected_values', array => 'missing_expected_mismatches' ]; 1;