Search code examples
javajavadoc

Custom exception, Javadoc unknown throwable exception


I have trouble with generating Javadoc, it complains

"Uknown throwable @throws pl.sydygaliev.java_journey.model.exception.WrongFormatException"

Here's the body of javadoc comment

/**
 * The method that is used to handle given keyword.
 * If keyword has illegal values, it returns null.
 * @param keyword is used for keyword validation
 * @return keyword with given value or null if keyword
 * has unacceptable characters
 * @throws WrongFormatException when there is unacceptable 
 * character for the keyword
 */
public String handleKeyword(String keyword) {

Javadoc Body of the custom exception

package pl.sydygaliev.java_journey.model.exception;


public class WrongFormatException extends Exception{
}

InitialHandlerAndStorer class where javadoc trouble occured and subpackage of custom exceptions within that package InitialHandlerAndStorer class where javadoc trouble occured


Solution

  • It appears that the method must have the following syntax:

    public String handleKeyword(String keyword) throws WrongFormatException{
    ...
    

    But since I had try and catch block within the function I couldn't create the above syntax. I removed try and catch block in the method and added the try and catch block elsewhere, where method was called