Class ApiException

All Implemented Interfaces:
Serializable

public abstract class ApiException extends RuntimeException
Base abstract class for all custom API exceptions in the application.

Instead of throwing generic exceptions, developers should extend this class to create specific business exceptions. This allows the GlobalExceptionHandler to automatically capture the specific HttpStatus and message defined by the subclass.

* @author Pasindu OG
Version:
1.2.0
See Also:
  • Constructor Details

    • ApiException

      protected ApiException(String message, org.springframework.http.HttpStatus status)
      Constructs a new ApiException with a detailed message and specific HTTP status.
      Parameters:
      message - The detail message explaining the cause of the error.
      status - The HttpStatus to be returned to the client.