def decide.answer

ezmcp@0.1.0.0 · src/rpc.bend:150

import ezmcp@0.1.0.0/src/rpc.bend as Rpc
import Base
import emerging-ezjson@1.2.0.0/src/value.bend as Value

150# a message with no method: a response when it has a valid id and exactly
151# one of result and error
152def decide.answer(
153  +has_id: Bool,
154  +id_ok: Bool,
155  +id: Value.Json,
156  has_result: Bool,
157  has_error: Bool
158) -> Msg:
159  Bool.pick(Msg, Bool.and(Bool.and(has_id, id_ok),
160      one(has_result, has_error)),
161    Answer{id}, Junk{head.id(has_id, id_ok, id), "Invalid Request: no method"})

Uses (7)

Used by (1)