Page 1 of 3

[Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 17:55
by m4rcel
As of an error in my scripts, I came across an 500 Internal Server Error. Whilte debugging it, I came across some more of them :D
  • create() on negative cost
    If the costs are set to a negative value, calling the create() method on the Payments class fails with a 500.
  • create() on fromLogin == toLogin
    If the fromLogin and toLogin fields are set both to the same value, you get another 500.
  • create() on wrong creatorSecurityKey or wrong creatorPassword
    If the SecurityKey or the Password is wrong, then the request is aborted with a 500.
  • pay() on missing id
    If the ID of the created Transaction is missing when calling pay(), guessing what you get? Yep, a 500 ^^
I think all of these error cases should be fixed to respond nice error messages instead of the 500 Internal Server Error :)

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 18:06
by TMarc
why don't you catch the errors in your script? :?

500 means your script is faulty, not the server.
The server just doesn't know what to display...

And the server does not necessarily know what you have intended there. ;)

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 18:16
by steeffeen
TMarc wrote:why don't you catch the errors in your script? :?

500 means your script is faulty, not the server.
The server just doesn't know what to display...

And the server does not necessarily know what you have intended there. ;)
"internal server error"!

INTERNAL
not EXTERNAL

when it's about the script or the requests there should be "bad request" errors if you ask me

and how do you come to "what to display"? since when do web services display something?

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 18:23
by TMarc
:roll: it doesn't matter if it is internal or external. an error is an error ;)
web services always display something.
In ideal case the success, in bad case a fail indication, and in worst case a useless message like this 500.

m4rcel, did you check the server logs if there are some details?

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 18:27
by TGYoshi
So he asks for a normal error instead of 500 which is a faulty coded thing server-sided.
500 errors are caused by Nando's programming server-sided, not by the user.

It's the difference between a crash to desktop (a faulty coded thing) and a popup showing "Negative transactions aren't possible".

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 18:32
by The_Big_Boo
TMarc, whatever you say, 5xx errors are server issues. Here it should send a 4xx response (a 400 actually).

Transactions are actually handled by the master server itself and the NadeoLive WS is using an internal API. From what I remember, an exception is created when the internal API sends an error but this kind of exception is supposed to be nicely sent back to the WS user. So something is indeed going wrong in the WS.

Edit:
TMarc wrote:m4rcel, did you check the server logs if there are some details?
He won't find anything. Details are on the WS server logs.

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 19:00
by TMarc
ok, thanks for the clarifications about this mysteries, something new learned today :thumbsup:

Re: [Transaction] Several 500 Internal Server Errors

Posted: 11 May 2013, 19:25
by m4rcel
Yes, all I want is a nice 4xx error instead of the 500, as 5xx is always the server's fault. For example, if not setting the creatorLogin, you already get "Missing login" (or so) as an 4xx error, so you directly know where the error is. With the 500, you only know that there IS an error, but not WHAT the error is... bad if you have a script dynamically creating transactions ;)

Re: [Transaction] Several 500 Internal Server Errors

Posted: 05 Jun 2013, 14:24
by steeffeen
the Payments web service seems to have a similar issue
i get an internal server error (500) when checking the payment with the following id

Code: Select all

$service->isPaid(1141226);
other ids work fine so i'm not sure what's exactly causing this

//Edit: the same applies for id "1143838", "1150997", "1150998", "1155389", "1155385", "1178036", "1179527", "1199256"
:D
i couldn't recognize a pattern yet, most of the failing transactions are paid ones, but there are also unpaid ids
i will add other ids as soon as i encounter error with them

Re: [Transaction] Several 500 Internal Server Errors

Posted: 06 Jun 2013, 22:21
by steeffeen
there is another internal server error thrown when you try to ->pay() a transaction with a cost which can't be payed because the account doesn't have enough planets :D