Class ResourceNotFoundException

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

@ResponseStatus(NOT_FOUND) public class ResourceNotFoundException extends RuntimeException
Exception thrown when a requested resource cannot be found in the database or system.

This exception is automatically mapped to an HTTP 404 NOT_FOUND response status by Spring using the ResponseStatus annotation. It's used throughout the Job Portal application when entities like jobs, candidates, recruiters, or applications cannot be found by their ID or other identifying attributes.

Examples of when this exception might be thrown:

  • User tries to view a job posting that has been deleted or doesn't exist
  • Candidate tries to access a non-existent application
  • Recruiter tries to update a profile that has been removed
Since:
2025-05-15
See Also:
  • Constructor Details

    • ResourceNotFoundException

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

      public ResourceNotFoundException(String message, Throwable cause)
      Constructs a new resource not found 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)
    • ResourceNotFoundException

      public ResourceNotFoundException(String resourceName, String fieldName, Object fieldValue)
      Constructs a new resource not found exception with a formatted message containing the resource name, field name, and field value that caused the exception.
      Parameters:
      resourceName - the name of the resource type that was not found (e.g., "Job", "Candidate")
      fieldName - the name of the field used to search for the resource (e.g., "id", "userId")
      fieldValue - the value of the field that was used in the search