swh.deposit.errors module

Module in charge of providing the standard sword errors

exception swh.deposit.errors.ParserError[source]

Bases: ValueError

Specific parsing error detected when parsing the xml metadata input

swh.deposit.errors.make_error_dict(key, summary=None, verbose_description=None)[source]

Utility function to factorize error message dictionary.

Parameters
  • key (str) – Error status key referenced in swh.deposit.errors module

  • summary (str/None) – Error message clarifying the status

  • verbose_description (str/None) – A more verbose description or work around a potential problem.

Returns

Dictionary with key ‘error’ detailing the ‘status’ and associated ‘message’

swh.deposit.errors.make_error_response_from_dict(req, error)[source]

Utility function to return an http response with error detail.

Parameters
  • req (Request) – original request

  • error (dict) – Error described as dict, typically generated

  • the make_error_dict function. (from) –

Returns

HttpResponse with detailed error.

swh.deposit.errors.make_error_response(req, key, summary=None, verbose_description=None)[source]

Utility function to create an http response with detailed error.

Parameters
  • req (Request) – original request

  • key (str) – Error status key referenced in swh.deposit.errors module

  • summary (str) – Error message clarifying the status

  • verbose_description (str / None) – A more verbose description or work around a potential problem.

Returns

Dictionary with key ‘error’ detailing the ‘status’ and associated ‘message’