
Hi, I look what is possible to use to report errors on our rest-service. I find summary there http://www.oreillynet.com/onlamp/blog/2003/12/restful_error_handling.html and improvement here http://www.dalouche.com/wordpress/2009/04/25/error-handling-in-rest-applicat.... For our purpose I think that the best sollution is to use our own error code which is not used, ( i that one which begin 4** is good) and in body specify type of error, needed data for generate report (like which permission mission and for which user) and english error description. This error description should not use frontend, as it must match type and print localized error description. So what I plan to do: - Defined exceptions in backend which modules should throw in case of errors - Add exceptions to webservice method where it is appropriate (like check_permission should not return anything, just throw exception because user already should check its permission) - Add rescue_from to application controller to automatic generate proper response code and body - Add error handler to webclient - ideal is throw exception which is catch by rescue_from and this exception contain response from which generate localized error page) For this I suggest little refactoring of resource loader, at least I try make it less dynamic to easier enhance it. Welcome any comments and suggestion. Now I create branch for it and try start which some ideas, so it doesn't break any code until it is ready. -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org

On Thursday 27 August 2009, Josef Reidinger wrote:
I would suggest to not go with an own error code, but use the existing ones. This makes it easier for generic HTTP clients. A 400 fits for most normal errors, and details can be given in the body of the response. -- Cornelius Schumacher <cschum@suse.de> -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org

On 08/27/2009 04:14 PM, Cornelius Schumacher wrote:
Hi, thanks for comment. I study error code and looks like 400 is not sufficient as it is Bad Request and mean that client should not repeat request without modification, so it could case in some case (like locked package management) problems on proxies and caches as it could filter same request. But I find that 409 Conflict looks like sufficient as it expect details in body and proxy should repeat request without problems. -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org

On Thursday 27 August 2009, Josef Reidinger wrote:
409 is usually used when writing to a resource which has changed inbetween, so this doesn't fit to the locked package management case. As it's a problem on the server, a 500 would be more appropriate in this case, maybe a 503. -- Cornelius Schumacher <cschum@suse.de> -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org

On 08/27/2009 04:59 PM, Cornelius Schumacher wrote:
Thanks it looks good. I use it. -- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Cornelius Schumacher
-
Josef Reidinger