Skip to content

refactor: replace config-driven Exception with typed HttpException hierarchy#227

Open
loks0n wants to merge 3 commits intomainfrom
refactor/errors
Open

refactor: replace config-driven Exception with typed HttpException hierarchy#227
loks0n wants to merge 3 commits intomainfrom
refactor/errors

Conversation

@loks0n
Copy link
Copy Markdown
Member

@loks0n loks0n commented Apr 9, 2026

Summary

  • Introduces HttpException base class with statusCode, type, publish, and previous — no Config lookup, everything self-contained
  • 11 named subclasses (RuntimeNotFoundException, ExecutionTimeoutException, etc.) replace the old string-constant system, making throw sites self-documenting
  • Two-tier error handler: HttpException instances are exposed as-is (respecting publish); any other \Exception is masked as a 500 and always published
  • RuntimeConflictException and RuntimeFailedException set publish: false; everything else defaults to true
  • Removes app/config/errors.php and the Config::load('errors') indirection entirely

Test plan

  • Trigger a known HTTP error (e.g. missing auth header) — verify correct type, message, and status code in response
  • Trigger a generic exception path — verify response is masked general_unknown 500
  • Verify publish: false exceptions (runtime conflict, runtime failed) are not forwarded to logger
  • Verify runtime not found, execution timeout, etc. return the expected HTTP codes

🤖 Generated with Claude Code

loks0n and others added 3 commits April 9, 2026 14:28
…erarchy

Introduces a two-tier error system:
- HttpException base class (statusCode, type, publish) for known HTTP errors
- 11 named subclasses (RuntimeNotFoundException, ExecutionTimeoutException, etc.) as self-documenting throw sites
- Generic \Exception falls through to the error handler as a masked 500 and is always published
- Removes the old constants + Config::load('errors') indirection entirely

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the framework's generic Utopia\Http\Exception with our own
GeneralRouteNotFoundException so the two-tier error handler sees an
HttpException and returns the correct 404.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant