java.lang.Object
it.gov.pagopa.onboarding.citizen.configuration.ExceptionMap

@Configuration public class ExceptionMap extends Object

Central registry mapping symbolic exception keys to concrete ClientException factories.

Provides a single lookup method to retrieve domain exceptions according to service specifications.

  • Constructor Details

    • ExceptionMap

      public ExceptionMap()

      Initializes the registry with supported exception mappings.

      Each entry associates a symbolic key from CitizenConstants.ExceptionName with a factory function that produces the corresponding ClientExceptionWithBody with appropriate HTTP status and error code.

  • Method Details

    • throwException

      public RuntimeException throwException(String exceptionKey, String message)

      Retrieves (does not throw) the exception instance associated with the provided key.

      If the key is missing, logs an error and returns a generic RuntimeException.

      Parameters:
      exceptionKey - symbolic exception key (see CitizenConstants.ExceptionName)
      message - descriptive message to include in the exception body
      Returns:
      RuntimeException instance (specific or generic if key not found)