Assume i have defined @ControllerAdvice

Java Code:
@ControllerAdvice
public class ErrorHandler {
 
     // example
    @ExceptionHandler(ParseException.class)
    public void handleParseException(ParseException exception, HttpServletResponse response) {
        // return response - error message, error description, error type (ERROR or EXCEPTION)
    }
}
The problem is where i will formulate the error message text with parameters and also the message type - ERROR or EXCEPTION

Example, Assume file not found exception is thrown for the given file name

Generally, in message.properties file we will be having text as File Doesn't Exist for file {0}

The translation of error message usually happens in the presentation layer.....

Now if we need to pass the error message so that controller advice takes care of passing it to the UI....

Do we need to construct the error message in the service layer before sending ??? Where the exception and the parameters will be binded ???

for example

Java Code:
public void accessFile(String fileName) { 
  File file = new File(fileName); 
  if(!file.exists()) { 
       throw new FileNotFoundException(Constants.FILE_NOT_FOUND.....); 
       How to construct the error message with property key and sending with proper error message binded with exception??? 
      so that in controller advice we would just use exception.getMessage() which will have the translated text. 

   } 
}
Please let me know how to do it.