chickadee » transmission » default-error-proc

default-error-proc result/con #!optional tag req respprocedure
with-transmission-result result success-proc #!optional (error-proc default-error-proc)procedure

Convenient way to handle a single RPC call's result.

with-transmission-result is similar to result-ref (either-ref from SRFI-189), except that the order of the success and failure procedures is swapped. The failure procedure defaults to default-error-proc, which calls error with a generic error message.

success-proc should be a procedure of 4 parameters: the arguments and tag fields of a reply message, the uri-common request object, and the intarweb response object.

failure-proc should be a procedure of 4 parameters, 3 of them optional: result/con, tag, req, and resp. result and tag are the fields of a reply message, req is the uri-common request object, and resp is the intarweb response object. tag, req, and resp are either all false or none false. If they're false, result/con is a condition object thrown during the API call; if they're not false, then result/con is a result string.