Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/errors.py
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | return make_error_dict( | ||||
"Missing SLUG header", | "Missing SLUG header", | ||||
verbose_description=( | verbose_description=( | ||||
"Provide in the SLUG header one identifier, for example the " | "Provide in the SLUG header one identifier, for example the " | ||||
"url pointing to the resource you are depositing." | "url pointing to the resource you are depositing." | ||||
), | ), | ||||
) | ) | ||||
class BadRequestError(ValueError): | class DepositError(ValueError): | ||||
"""Represents a bad input from the deposit client | """Represents an error that should be reported to the client | ||||
""" | """ | ||||
def __init__(self, summary, verbose_description): | def __init__(self, key, summary, verbose_description): | ||||
self.key = BAD_REQUEST | self.key = key | ||||
self.summary = summary | self.summary = summary | ||||
self.verbose_description = verbose_description | self.verbose_description = verbose_description | ||||
def to_dict(self): | def to_dict(self): | ||||
return make_error_dict(self.key, self.summary, self.verbose_description) | return make_error_dict(self.key, self.summary, self.verbose_description) |