views:

631

answers:

0

Hello there,

Don't know if this particular forum is the best place to ask this question...

What is the best way to handle error response codes generated from Facebook REST API calls using server side Java?

For example, if in a deployed app, a person calls Friends.get:

http://wiki.developers.facebook.com/index.php/Friends.get

The following error response codes could be generated (in JSON or XML):

1 An unknown error occurred. Please resubmit the request.

2 The service is not available at this time.

4 The application has reached the maximum number of requests allowed. More requests are allowed once the time window has completed.

5 The request came from a remote address not allowed by this application.

101 The API key submitted is not associated with any known application.

102 The session key was improperly submitted or has reached its timeout. Direct the user to log in again to obtain another key.

103 The submitted call_id was not greater than the previous call_id for this session. 104 Incorrect signature.

Figured that I would write my own custom exceptions which are bubbled:

http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html

But my project lead says that throwing custom exceptions isn't the way to go!?!

Would appreciate it if someone could suggest an alternative approach to handle the Facebook REST API error codes...

Thank you for taking the time to read this.

Happy programming.