How to handle errors?

257 views
Skip to first unread message

co...@realtyprosolutions.com

unread,
Jul 15, 2017, 1:50:12 PM7/15/17
to PHRETS
I am using PHRETS 2 to connect to several different RETS feeds and update data. From time to time login credentials change. When this happens Fatal errors are produced such as:

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message ' in W:\wamp\www\realtytours.dev\public_html\includes\phrets\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 111
GuzzleHttp\Exception\ClientException: Client error: `GET http://retsgw.flexmls.com/rets2_3/Login` resulted in a `401 Unauthorized` response: <?xml version="1.0"?> <RETS ReplyText="Authentication Failure: Invalid login or password supplied. See: http://flexmls.c (truncated...) in W:\wamp\www\realtytours.dev\public_html\includes\phrets\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 111

Instead of it producing a Fatal error and killing my script, how just check for a bad login, skip it, and let the script continue running to the end???

Troy Davisson

unread,
Jul 15, 2017, 1:55:21 PM7/15/17
to PHRETS
The fatal error is because an exception isn't being caught.  See the following documentation for some ideas on how you can look for particular errors and either ignore them or recover:


In this specific case, you'd be looking at something like:

try {
   $session->Connect();
} catch (\GuzzleHttp\Exception\ClientException $e) {
   echo "Shoot, something bad happened: " . $e->getMessage() . "\n";
   // do something now that a bad error has happened
}

In an upcoming version, PHRETS will probably change to using it's own set of exceptions to keep things cleaner, but for now, you can catch this and continue.

--
You received this message because you are subscribed to the Google Groups "PHRETS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phrets+un...@googlegroups.com.
To post to this group, send email to phr...@googlegroups.com.
Visit this group at https://groups.google.com/group/phrets.
For more options, visit https://groups.google.com/d/optout.

Brian Liccardo

unread,
Apr 9, 2018, 1:38:32 PM4/9/18
to PHRETS
This seems to no longer apply, is there an update to this for the latest version of PHRETS (2.6)?

ShawmutSteve

unread,
Dec 13, 2018, 8:01:35 PM12/13/18
to PHRETS
Is there an update to this issue?  I'm getting essentially the same exception, but I am catching RequestException in both the ->Login() and the ->Search()

It is difficult to understand from the call stack where my code is.  I don't see it anywhere.  But I do believe this is happening on a ->Search() to a server with no offset support.

The interesting thing - this is reproducible.

PHP Fatal error:  Uncaught GuzzleHttp\Exception\RequestException: cURL error 56: Recv failure: Connection reset by peer (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:186

Stack trace:
#0 /vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 /vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 /vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 /vendor/guzzlehttp/guzzle/src/Handler/Proxy.ph in /vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 186


Thank you
Steve

ra...@thebestmedia.com

unread,
Feb 4, 2019, 10:23:22 AM2/4/19
to PHRETS
Hey, I have the same error. Were you able to fix it?

ShawmutSteve

unread,
Jul 12, 2019, 5:13:45 PM7/12/19
to PHRETS
Can anyone suggest a fix for this?  It's still rampaging here, and currently causing an issue with data from an Open House table where I cannot (at all) get the bulk of the open house data.

Thank you 
Reply all
Reply to author
Forward
0 new messages