tijddy (1) [Avatar] Offline
#1
RubyAMF has been both a source of joy and pain to me in the last little while. I love the idea, but the lack of documentation makes it very hard to use. The part I am struggling with right now is error handling. In your example code, if you ever have an error, you just render the errors object.

i.e.
format.amf {render :amf => @task.errors }

From the best I can tell, this is still going to call the result method in the command class, not the fault method. The result method however, is not going to be passed a task object like it is expecting. In order to actually call the fault method the controller needs to return a FaultObject. I could be totally wrong as there is very little information about this stuff out there ( so thank you for writing this book).

I understand that in most tutorials error handling is ommited, but (If i understand error handling in rubyamf correctly) your error handling is a little misleading, as, if there was an error, the program would break (as an unexpected type would be returned to the IResponder's result method)
peterarmstrong (94) [Avatar] Offline
#2
Re: rubyAMF errors
I struggled with the lack of documentation too!

Note that what I do in the book is use fault handling for HTTP faults, not for "there's an error on the server" types of faults. Those errors are rendered (for both RubyAMF and XML over HTTPService as an XML result, and I should handle the result accordingly and check its content)...