Generalize BadRequestError to be a DepositError.
First step toward using exceptions instead of dicts everywhere.