petermcd / petermcd/monzo-api

v2 P2: Exception hierarchy with real context

Open
#157 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
36
Forks
7
Avg merge
4m
Merged PRs (30d)
2

Description

Part of the v2 roadmap (pillar P2 — foundation).

Today, every raised exception is raise exception_cls() from error — no status code, no Monzo error body, no message. A caller catching MonzoHTTPError has no way to know what actually went wrong without attaching a debugger.

Scope

  • Attach HTTP status, Monzo's error code, message, and the raw response body to every exception instance.
  • Fill gaps in MONZO_ERROR_MAP: 404 currently falls into the generic MonzoHTTPError rather than a dedicated not-found class; 502/503 aren't mapped at all.
  • Keep the existing class names as the public surface so except MonzoRateError keeps working — the break is in what the instance now carries.

Breaking: yes (exception instance shape changes; new subclasses)
Effort: M
Phase: alpha

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the exception-raising path and inspect MONZO_ERROR_MAP, focusing on where HTTP status, Monzo error details, and response bodies are currently discarded. Done means exceptions carry the specified context, 404/502/503 resolve to dedicated mapped classes, and existing class names remain catchable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.