GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
AnyEvent::CouchDB::Exceptions(3) User Contributed Perl Documentation AnyEvent::CouchDB::Exceptions(3)

AnyEvent::CouchDB::Exceptions - Exception::Class-based exceptions for AnyEvent::CouchDB

  use feature 'switch';
  use Try::Tiny;
  use Data::Dump 'pp';
  use AnyEvent::CouchDB;

  my $db = couchdb("food");
  try {
    my $vegetables = $db->open_doc('vegetables')->recv;
  } 
  catch {
    when (ref eq 'AnyEvent::CouchDB::Exception::HTTPError') {
      # handle an HTTP error
    }
    when (ref eq 'AnyEvent::CouchDB::Exception::JSONError') {
      # handle a JSON decoding error
    }
    default {
      $_->show_trace(1);
      warn "$_";
      warn "HEADERS  : " . pp($_->headers);
      warn "BODY     : " . $_->body;
    }
  };

This module defines a family of exception classes.
AnyEvent::CouchDB::Exception
The base exception class who's superclass is Exception::Class::Base
AnyEvent::CouchDB::Exception::HTTPError
A subclass of AnyEvent::CouchDB::Exception for HTTP errors
AnyEvent::CouchDB::Exception::JSONError
A subclass of AnyEvent::CouchDB::Exception for JSON decoding errors

This module provides the following methods in addition to the methods provided by Exception::Class::Base.

$e->headers

This method will return the HTTP response headers if they were available at the time the exception was thrown.

$e->body

This method will return the HTTP response body if it was available at the time the exception was thrown.

2011-08-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.