Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

I am trying to figure out what the errors endpoint is used for, so I can I can implement it in my API.

I have been trying things like:

And I am getting a File Not Found Error in Firefox.

All the errors help page says is:

Summary
Simulates an error given a code

What are valid error codes? And, can we get some sort of response telling us that we supplied a bad error code?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

The /errors method was requested to make it easier to test libraries. Finding questions/users/etc. that result in certain error cases can be... trying, and potentially quite brittle.

Defined Error Codes:

Invalid error codes result in a 404 error (NotFound).

share|improve this answer
    
Could you please provide me with an example link for a working error call to the api? –  jjnguy Jun 1 '10 at 2:54
    

Pass the parameter ?type=jsontext to see error JSON

http://api.stackoverflow.com/0.8/errors/404?type=jsontext

http://api.stackoverflow.com/0.8/errors/500?type=jsontext

Note: if you don't put ?type=jsontext, error code is simulated only in http response header, so firefox just give you error page.

share|improve this answer
    
This is incorrect, the JSON body is always returned. Firefox just doesn't show it to you by default. Either view source, or watch the HTTP traffic in a sniffer to see the error message. –  Kevin Montrose Jun 1 '10 at 6:55
    
@Kevin, You're right, I've crossed-out that part, my firefox just gave me alert Firefox can't find the file at http://api.stackoverflow.com/0.8/errors/4005., view-source was not viewable, so I assumed it was only in http headers. didn't watch with HTTP traffic, I stand corrected. –  YOU Jun 1 '10 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .