Class ExceptionMap
java.lang.Object
it.gov.pagopa.onboarding.citizen.configuration.ExceptionMap
Central registry mapping symbolic exception keys to concrete ClientException factories.
Provides a single lookup method to retrieve domain exceptions according to service specifications.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionthrowException(String exceptionKey, String message) Retrieves (does not throw) the exception instance associated with the provided key.
-
Constructor Details
-
ExceptionMap
public ExceptionMap()Initializes the registry with supported exception mappings.
Each entry associates a symbolic key from
CitizenConstants.ExceptionNamewith a factory function that produces the correspondingClientExceptionWithBodywith appropriate HTTP status and error code.
-
-
Method Details
-
throwException
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 (seeCitizenConstants.ExceptionName)message- descriptive message to include in the exception body- Returns:
RuntimeExceptioninstance (specific or generic if key not found)
-