I'm attempting to write an IPC responder in Ruby, and have defined a
protocol that can return either a result (record) or an error (error
record).

I posted a longer form of the question on StackOverflow, but I'd be happy
to receive input from anyone who has experience doing this in other
languages, as I think I could adapt the Ruby code once I saw another
example.

-
https://stackoverflow.com/questions/57197801/how-to-return-errors-from-ipc-rpc-with-avro-ruby

Essentially, given this schema, how does one write a handler which returns
an `Error` record (or raises, etc, etc)

{
  "protocol": "Geocoder",
  "types": [
    {
      "name": "Error",
      "type": "error",
      "fields": [
        { "name": "message", "type": "string" },
        { "name": "permanent", "type": "boolean" },
        { "name": "backtrace", "type": "string" }
      ]
    },
    {
      "name": "GeocodedLocation",
      "type": "record",
      "fields": [
        { "name": "latitude", "type": "double" },
        { "name": "longitude", "type": "double" },
        { "name": "accuracy", "type": "double"}
      ]
    }
  ],
  "messages": {
    "geocode": {
      "request": [{ "name": "address", "type": "Address"}],
      "response": "GeocodedLocation",
      "errors": ["Error"]
    }
  }}


Any comment is welcomed, thank you kindly,

Lee Hambley
http://lee.hambley.name/
+49 (0) 170 298 5667

Reply via email to