diff --git a/src/main/java/com/github/zafarkhaja/semver/ParseException.java b/src/main/java/com/github/zafarkhaja/semver/ParseException.java index 6596b87..4e77495 100644 --- a/src/main/java/com/github/zafarkhaja/semver/ParseException.java +++ b/src/main/java/com/github/zafarkhaja/semver/ParseException.java @@ -58,6 +58,19 @@ public ParseException(String message, UnexpectedCharacterException cause) { super(message); initCause(cause); } + + /** + * Returns the message of this exception. If the message is not set, + * returns the string representation provided by toString() + * + * @return the message of this exception + */ + @Override + public String getMessage() { + if (super.getMessage() != null) + return super.getMessage(); + return toString(); + } /** * Returns the string representation of this exception.