Skip to content
  • Geoff Lawler's avatar
    Merge Errors speak GRPC now. · b2fc0f6c
    Geoff Lawler authored and Ryan Goodfellow's avatar Ryan Goodfellow committed
    The MergeError type can now be tranmitted via GRPC errors. So the
    sequence is:
    
    1. portal module generates a error
    2. The error percolates up to the grpc service layer
    3. The grpc service layer converts the error to grpc error
    4. The client layer gets the error and recreates the MergeError
    5. The API layer gets the MergeError and converts it to an API Error
    6. The client gets the error as a http response, with JSON in the body
       and the appropriate error code.
    
    There are 3 error formats at play here.
    
    The MergeError type is based on RFC 7320
    The GRPC Error is based on Google GRPC Error Codes
    The Open API error HTTP status codes
    
    And RFC 7320 is an "extention" of HTTP Status codes, so it's really like
    2.5 error formats.
    
    So there are things that don't quite fit. The general approach is that
    if an error fits within an HTTP status (e.g. 404 Not Found), that will
    work. If it does not ("Project already exists"), it will get mapped to a
    400 HTTP Status and the body of the error will have the RFC 7320 fields
    b2fc0f6c