The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Store PHP wrapper library errors

Highlighted
Occasional Visitor

Store PHP wrapper library errors

Hi All,

 

I'm wondering if there's  way to store the errors produced by the php wrapper library, rather than having them automatically thrown to the browser.  I can check for existing users and deal with it that way, but there might be other errors I don't need the user seeing, and it breaks the rest of my page.

 

Constant Contact HTTP Request Exception: Error 409: Email address test3@example.com is already a contact

Like I said I can check for this, but I don't want anything like the above output to the browser. 

 

I'm using the following and tried using ob_start() and ob_get_contents() to prevent this but the class itself throws there error and kills everything else.

 

$NewContact = $ConstantContact->addContact($Contact);

 

Is there a setting I'm missing?

 

Thanks in advance,

Jason

1 REPLY 1
Highlighted
Employee

Re: Store PHP wrapper library errors

Hi Jason,

 

Sorry, but the wrapper was only configured to throw errors to the browser.  You'd have to really dig into error handling in the wrapper to suppress all errors.  I can say that the 409 (duplicate entry) and 400 errors are by far the most common errors, so if you account for those in your code, you likely won't see many other types of errors.  

 

Best Regards,

Shannon W.

API Support Specialist

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured