Commit a895f9a26f25c68fdea2317c727effa8636e89d0
1 parent
1b04daae
New version of send_result() function, using Result() instead of Maybe()
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
calexium_lib/net_services/CXM_generic_protocol.anubis
| @@ -90,6 +90,21 @@ public define One | @@ -90,6 +90,21 @@ public define One | ||
| 90 | failure then send_ACK_error(queue, cmd_id), | 90 | failure then send_ACK_error(queue, cmd_id), |
| 91 | success(msg) then send_ACK_ok(queue, cmd_id, msg) | 91 | success(msg) then send_ACK_ok(queue, cmd_id, msg) |
| 92 | }. | 92 | }. |
| 93 | + | ||
| 94 | +public define One | ||
| 95 | + send_result | ||
| 96 | + ( | ||
| 97 | + MessageQueue queue, | ||
| 98 | + Word32 cmd_id, | ||
| 99 | + Result((Word32, String), Message) mb_msg | ||
| 100 | + )= | ||
| 101 | + if mb_msg is | ||
| 102 | + { | ||
| 103 | + error(err) then | ||
| 104 | + if err is (err_code, err_string) then | ||
| 105 | + send_ACK_error(queue, cmd_id, err_code, err_string), | ||
| 106 | + ok(msg) then send_ACK_ok(queue, cmd_id, msg) | ||
| 107 | + }. | ||
| 93 | 108 | ||
| 94 | public define One | 109 | public define One |
| 95 | send_result | 110 | send_result |