Skip to content

Refactor PolarisException status mapping into PolarisException hierarchy #5167

Description

@flyrain

Is your feature request related to a problem? Please describe.

Summary

Today, PolarisExceptionMapper is responsible for mapping every PolarisException subtype to an HTTP Response.Status. This creates coupling between the mapper and every exception type.

Proposal

Invert this relationship by making PolarisException define a required method that returns its corresponding Response.Status. Each exception subclass would provide its own status, allowing PolarisExceptionMapper to delegate to the exception instead of maintaining a centralized mapping.

Benefits include:

  • Reduces coupling between PolarisExceptionMapper and exception implementations.
  • Makes it easier to add new exception types without modifying the mapper.
  • Keeps the HTTP status semantics alongside the exception definition.

This is a follow up to the discussion in PR #4961.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions