Coder Social home page Coder Social logo

Comments (5)

Exeu avatar Exeu commented on May 25, 2024

Sorry but this does not belong to the library. It should be more on the application side instead here.

from apai-io.

Niteblade avatar Niteblade commented on May 25, 2024

So what you're saying is that it's up to me to write some kind of error handling procedure for your code?

[16-Jan-2015 12:51:44 GMT] PHP Fatal error: Uncaught SoapFault exception: [aws:Server.InternalError] We encountered an internal error. Please try again. in /home/_/public_html/__Apai-IO/vendor/exeu/apai-io/lib/ApaiIO/Request/Soap/Request.php:152
Stack trace:
#0 /home/
/public_html/__Apai-IO/vendor/exeu/apai-io/lib/ApaiIO/Request/Soap/Request.php(152): SoapClient->__soapCall('BrowseNodeLooku...', Array)
#1 /home/**
/public_html/__Apai-IO/vendor/exeu/apai-io/lib/ApaiIO/Request/Soap/Request.php(67): ApaiIO\Request\Soap\Request->performSoapRequest(Object(ApaiIO\Operations\BrowseNodeLookup), Array)
#2 /home/_/public_html/__Apai-IO/vendor/exeu/apai-io/lib/ApaiIO/ApaiIO.php(73): ApaiIO\Request\Soap\Request->perform(Object(ApaiIO\Operations\BrowseNodeLookup))
#3 /home/
/public_html/**/amazonNodes/config.php(81): ApaiIO\ApaiIO->runOperation(Object(ApaiIO\Operations\BrowseNodeLookup))
#4 /home/**
/public_html/_/_amazonNodes/03_UpdateChildNodes.php(59): _BrowseAmazon('12306')
#5 /home/
/public_html/**/amazonNodes/03 in /home/***/public_html/__Apai-IO/vendor/exeu/apai-io/lib/ApaiIO/Request/Soap/Request.php on line 152

from apai-io.

Exeu avatar Exeu commented on May 25, 2024

no you write a error handling procedure which covers your problems, which both caused by Aws and/or some connection problems of your server ;)

from apai-io.

Niteblade avatar Niteblade commented on May 25, 2024

Just wanted to share this in case anyone else has the same issue.

I changed from SOAP to REST.
I edited the "Rest" Request.php file and added (Somewhere around line 162):

if (false == $result)  {    
$limit = 0;
while((curl_errno($ch) == 7 or curl_errno($ch) == 28 or $limit = 0) and $limit < 6)
    {
        sleep (5);
        $result = curl_exec($ch);
        $limit++;
    }
}

I will include more of the surrounding code so that others will be able to find where to add it easily:

        $curlError = false;
        $errorNumber = null;
        $errorMessage = null;

        $result = curl_exec($ch);

        /* Added */
        if (false == $result) { 
            $limit = 0;
            while((curl_errno($ch) == 7 or curl_errno($ch) == 28 or $limit = 0) and $limit < 6)
            {
                sleep (5);
                $result = curl_exec($ch);
                $limit++;
            }
        }
        /* End of Added */

        if (false === $result) {
            $curlError = true;
            $errorNumber = curl_errno($ch);
            $errorMessage = curl_error($ch);
        }

        curl_close($ch);

from apai-io.

cyrrill avatar cyrrill commented on May 25, 2024

Having the error handling inside the API library itself is easier than having to implement it at the application level.

I would prefer for this code to be more parametric, allowing the number of retries to be determined, either by configuration or by function call parameter. As well, the use of a known Exception type would be ideal, so the application can be coded to handle the permanent fail condition, rather than a simple retry.

The fact is, that any application which needs to connect to the Amazon API will at some point encounter these exceptions. I've even seen it happen on AWS EC2 machines, which have a very good uptime and are part of Amazon's own infrastructure. We should think of this as an expected scenario rather than an odd edge case.

That being the case, it would be nicer for retry to be part of the library itself. Why have everyone reinvent the wheel, when a standard implementation for needed code can be provided?

from apai-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.