Page MenuHomeSoftware Heritage

Convention for error passing from storage "backend" to storage "API server" to storage "API client"
Closed, MigratedEdits Locked

Description

in rDSTO

The swh.storage module is split in three layers :

  • swh.storage.storage, the "local storage" / "storage backend;
  • swh.storage.api, the "Storage API server";
  • swh.storage.remote_storage, the "Storage API client".

Currently, errors/exceptions raised in swh.storage.storage aren't passed through to the upper layers, and you only get an error 500 from the API server. This will become evident once exceptions get tested in swh.storage.storage as the tests for remote_storage are identical.

We need to define and implement a convention to be able to pass through the errors from the bottom layer through to the Storage API client.

Event Timeline

olasd raised the priority of this task from to Needs Triage.
olasd updated the task description. (Show Details)
olasd added a project: Developers.
olasd added a subscriber: olasd.

We should standardize on :

  • an HTTP error code (400 / Bad Request ?)
  • a serialization format for the answer (JSON, probably serializing the error type and error args), e.g.
{
    'exception': e.__class__.__name__,
    'args': e.args,
}

and then deserialize that and raise in the client.

the {exception:.../args:....} proposal + re-raising in the client looks good to me

olasd triaged this task as High priority.Sep 24 2015, 3:03 PM
olasd claimed this task.

Resolved as of rDSTO2b46e6941afe

The current implementation wraps pickled exceptions in a msgpack request body, which breaks language-agnosticity of the storage API but works...

olasd changed the visibility from "All Users" to "Public (No Login Required)".May 13 2016, 5:05 PM