Skip to content

feat: named error codes for ports - #25

Merged
parnexcodes merged 2 commits into
mainfrom
feat/port-error-codes
Oct 11, 2026
Merged

parnexcodes merged 2 commits into
mainfrom
feat/port-error-codes

Conversation

@parnexcodes

Copy link
Copy Markdown
Member

Closes #24

What

Adds the port_not_found (404), port_limit_reached (409) and ports_unavailable (503) error codes to this SDK's named codes, the same way the connector and image codes were added. README notes that port 2222 is reserved (validation_error) and a Dock exposes at most 10 ports.

Why

Backend returns these codes for the ports API (verified against apps/backend/src/docks/dock-ports.service.ts); SDK users should not need string literals.

How to verify

Run the SDK test suite; the error-code test now covers the three port codes.

Risk

Low. Additive constants/classes and docs only.

🤖 Generated with Claude Code

parnexcodes and others added 2 commits October 11, 2026 08:45
Fixes #24

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@parnexcodes

Copy link
Copy Markdown
Member Author

Review: feat: named error codes for ports

Verdict: SHIP

Checked against usedock/dock main (2fb1128), apps/backend/src/docks/dock-ports.service.ts: ports_unavailable 503 (ServiceUnavailableException), port_limit_reached 409 (ConflictException, MAX_PORTS_PER_DOCK = 10), port_not_found 404 (NotFoundException on remove), and port 2222 in RESERVED_PORTS -> BadRequestException validation_error. Codes, statuses, the 10-port limit and the 2222 claim in the README all match. The SDK does no client-side port validation, so the 2222 error does come from the API.

Naming follows the existing typed-subclass pattern (PortNotFoundError, PortLimitReachedError, PortsUnavailableError), registered in _BY_CODE and exported from usedock. The parametrized test checks code, status and class for all three.

Fixed on the branch (ac78d34): the new names were inserted before Operation/Port in __all__, which is otherwise alphabetical; moved them after Port.

Blocking

None.

Non-blocking

None.

Checks

  • ruff check ., ruff format --check ., mypy: pass
  • pytest tests/test_client.py: 63 passed, 1 skipped
  • CI on ac78d34 (test 3.9/3.13, gitleaks, cla): pass

@parnexcodes
parnexcodes merged commit f0cee3e into main Oct 11, 2026
7 checks passed
@parnexcodes
parnexcodes deleted the feat/port-error-codes branch October 11, 2026 03:19
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sdk: named error codes for ports; document port limits

1 participant