Class BadRequestException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
me.josephsf.jobportaljosephsfeir.exception.BadRequestException
All Implemented Interfaces:
Serializable

@ResponseStatus(BAD_REQUEST) public class BadRequestException extends RuntimeException
Exception thrown when a client sends a request with invalid parameters or data.

This exception is automatically mapped to an HTTP 400 BAD_REQUEST response status by Spring using the ResponseStatus annotation. It's used throughout the Job Portal application when validation fails or when the client provides inappropriate values that cannot be processed by the application.

Examples of when this exception might be thrown:

  • User tries to register with an email that's already in use
  • Candidate applies to a job they've already applied to
  • Recruiter creates a job with invalid salary range
  • User submits data that fails validation rules
Since:
2025-05-15
See Also:
  • Constructor Details

    • BadRequestException

      public BadRequestException(String message)
      Constructs a new bad request exception with the specified detail message.
      Parameters:
      message - the detail message (which is saved for later retrieval by the Throwable.getMessage() method)
    • BadRequestException

      public BadRequestException(String message, Throwable cause)
      Constructs a new bad request exception with the specified detail message and cause.
      Parameters:
      message - the detail message (which is saved for later retrieval by the Throwable.getMessage() method)
      cause - the cause (which is saved for later retrieval by the Throwable.getCause() method)