Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ParseException.getMessage() #39

Closed
wants to merge 1 commit into from

Conversation

jsimomaa
Copy link

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
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
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