IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 28, 2019, 4:10:51 PM (7 years ago)
Author:
eugene
Message:

handle more of the server error responses rather than simply emitting unhandled fault

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20191011/Nebulous/lib/Nebulous/Client.pm

    r40680 r40991  
    418418
    419419        if (defined $locations) {
     420            # XXX this is an example of passing 'find_invalid' to find_instances
    420421            my $instances = $self->find_instances($key, undef, 'find them all');
     422            if (not defined $instances) {
     423                die "no instances";
     424            }
    421425            if (scalar @$instances == 1) {
    422426                # only one instance nothing to do
     
    448452            }
    449453        }
    450 
    451454    };
    452455    if ($@) {
     
    663666    if ($response->fault) {
    664667        $self->set_err($response->faultstring);
     668
     669        ## invalid object key
     670        if ($response->faultstring =~ /is valid object key/) {
     671            $log->debug( "leaving" );
     672            die "invalid key $key, fails 'is valid object key' test\n";
     673        }
     674
     675        ## invalid object key
     676        if ($response->faultstring =~ /xattr is in user. namespace/) {
     677            $log->debug( "leaving" );
     678            die "invalid xattr key $name : fails 'xattr is in user. namespace' test\n";
     679        }
     680
    665681        $log->logdie("unhandled fault - ", $self->err);
    666682    }
     
    690706    if ( $response->fault ) {
    691707        $self->set_err($response->faultstring);
     708
     709        ## invalid object key
     710        if ($response->faultstring =~ /is valid object key/) {
     711            $log->debug( "leaving" );
     712            die "invalid key $key, fails 'is valid object key' test\n";
     713        }
     714
     715        ## invalid xattr key (not in user. namespace)
     716        if ($response->faultstring =~ /xattr is in user. namespace/) {
     717            $log->debug( "leaving" );
     718            die "xattr $name is invalid : xattr is in user. namespace\n";
     719        }
     720
     721        ## invalid xattr key
     722        if ($response->faultstring =~ /user\..*? does not exist/) {
     723            $log->debug( "leaving" );
     724            die "xattr key $name not found : xattr $name does not exist\n";
     725        }
    692726        $log->logdie("unhandled fault - ", $self->err);
    693727    }
     
    747781    if ( $response->fault ) {
    748782        $self->set_err($response->faultstring);
     783
     784        ## invalid object key
     785        if ($response->faultstring =~ /is valid object key/) {
     786            $log->debug( "leaving" );
     787            die "invalid key $key, fails 'is valid object key' test\n";
     788        }
     789
     790        ## invalid xattr key (not in user. namespace)
     791        if ($response->faultstring =~ /xattr is in user. namespace/) {
     792            $log->debug( "leaving" );
     793            die "xattr $name is invalid : xattr is in user. namespace\n";
     794        }
     795
     796        ## invalid xattr key
     797        if ($response->faultstring =~ /user\..*? does not exist/) {
     798            $log->debug( "leaving" );
     799            die "xattr key $name not found : xattr $name does not exist\n";
     800        }
     801
    749802        $log->logdie("unhandled fault - ", $self->err);
    750803    }
     
    871924    if ( $response->fault ) {
    872925        $self->set_err($response->faultstring);
     926
    873927        # check to see if this failure is because $key doesn't exist
    874928        if ($response->faultstring =~ /is valid object key/) {
     
    878932        # key is valid but no instances are on the specified volume
    879933        if ($response->faultstring =~ /no instances on storage volume/) {
     934            $log->debug( "leaving" );
     935            return;
     936        }
     937        # check to see if this failure is volume is unknown
     938        if ($response->faultstring =~ /is not a valid volume name/) {
     939            $log->debug( "leaving" );
     940            return;
     941        }
     942        # key is valid but no instances are on the specified volume
     943        if ($response->faultstring =~ /no instances available for key/) {
    880944            $log->debug( "leaving" );
    881945            return;
     
    9721036
    9731037
     1038## this is used by PS:IPP:Config nebulous functions
    9741039sub find
    9751040{
     
    10141079    return $path;
    10151080}
    1016 
    10171081
    10181082sub open
     
    11271191    my $locations;
    11281192    if ($invalid) {
     1193        # XXX this is an example of passing 'find_invalid' to find_instances
    11291194        $locations = $self->find_instances( $key, 'any', 'find them all');
    11301195    }
Note: See TracChangeset for help on using the changeset viewer.