Skip to content

RPC layer should allow for returning error bodies #316

Closed

Description

@jsha

Right now RPCs just return empty bodies if there is any error. This means that if, say, the RA returns an UnauthorizedError, the WFE can't turn that into a 401 response code, nor provide a useful error message to the client.

Activity

  1. added this to the General Availability milestone on Jun 6, 2015
  2. jcjones commented on Jun 6, 2015

    @jcjones
    Contributor

    Marking help-wanted; I think this would be a great intro to the RPC system for a new contributor.

  3. jsha commented on Jun 8, 2015

    @jsha
    ContributorAuthor

    One possible implementation: Instead of sending a JSON object representing their return type, RPC replies could send a JSON object that contains a field: returnValues, whose value is a JSON array of values returned from the implementing function. We could additionally define custom MarshalJSON and UnmarshalJSON methods for error that would turn errors into {value: "Some error", type: "UnauthorizedError"}.

    When receiving a JSONified error, if the type was equal to string, we'd instantiate the correct type of error and fill it with the .Value(). For error types that are not equal to string, we'd just instantiate a generic error with the right value string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions