Skip to content

Add ParseException.getMessage()#39

Closed
jsimomaa wants to merge 1 commit intozafarkhaja:masterfrom
jsimomaa:master
Closed

Add ParseException.getMessage()#39
jsimomaa wants to merge 1 commit intozafarkhaja:masterfrom
jsimomaa:master

Conversation

@jsimomaa
Copy link
Copy Markdown

Overriding getMessage() in order to prevent cases where detailMessage = null in order to provide descriptive messages

See #38 for more detail

Overriding getMessage() in order to prevent cases where `detailMessage = null` in order to provide descriptive messages
heisluft added a commit to AntiLaby/jsemver that referenced this pull request Jan 31, 2019
@zafarkhaja
Copy link
Copy Markdown
Owner

Hello Jani, I hope you're doing well!

Sorry it took me this long to get back to you.

I appreciate you taking the time and effort to contribute, but to be honest I fail to see the value in overriding Throwable.getMessage() like this. I mean the method is there, you can call it and get the message if it's present. And if it's not, calling ParseException.toString() won't help as it ultimately does the same thing, calls the parent's getMessage(). Also, calling any one of them when detailMessage is null results in StackOverflowError as they keep calling each other back and forth :)

@zafarkhaja zafarkhaja closed this Apr 11, 2023
@zafarkhaja
Copy link
Copy Markdown
Owner

Sorry, initially missed the reference to the issue, somehow.

The details there revealed that the real problem is not in ParseException, but in UnexpectedCharacterException: it doesn't pass any messages to its parent. The proposed change, however, still isn't a good fix as it breaks ParseException. Will fix it soon.

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants