Page MenuHomeSoftware Heritage

Improve error messages for deposit checks
Closed, MigratedEdits Locked

Description

When deposit is rejected there are a few reasons it can happen:

  • wrong domain (mismatch between url domain and client domain)
  • missing metadatas
  • missing content

Event Timeline

moranegg triaged this task as Normal priority.Mar 30 2018, 11:52 AM
moranegg created this task.

Raise an exception that is more useful than P279.
ValueError("unexpected mime type $foo") for example..

Raise an exception that is more useful than P279.
ValueError("unexpected mime type $foo") for example..

To give details, that's not supposed to happen.
A 500 error is really a bug.

Currently it should return a 400 (bad request) with the error message explaining why the request is wrong.
Here the mimetype check happens, as it's wrong, continues to explain but the code within explodes, thus the 500.

That's the culprit line:
https://forge.softwareheritage.org/source/swh-deposit/browse/master/swh/deposit/api/deposit_update.py$63

Checking, i introduced it to support other mimetypes.
Unfortunately, the test checking this is ok for the wrong reason. So here is the hole.

Like i said elsewhere, fixing it ;)

So apparently, there is a hole in the tests.

Yes, a bunch of stuff went wrong there, see commit rDDEP173905825e71b71bb4d0960efcf270ac71547c0e for details (oops ;)