Remove punctuation in Exception messages
See original GitHub issueMany Exception messages contain exclamation marks (!) at the end of the Exception message, for example:
“Object must not be null!”
While this alerts the user to an immediate problem in his/her code, it could be construed as abrasive.
Additionally, using any form of punctuation in Exception messages is not conducive for chaining. Generally, in Java Exception/Error (Throwable) chaining, the messages from the underlying Exceptions (causes) are chained together with the outer, wrapping Exception, for example:
java.lang.IllegalArgumentException: "Message from the wrapping IllegalArgumentException followed by; Message of the caused by Exception"
at ...
caused by: java.lang.IllegalStateException: Message of the caused by Exception
at ...
That is, the Exception messages from the chain are appended and separated by the ;
.
If the messages from the wrapping Exceptions in the Exception chain contain punctuation, then it can lead to confusing text:
java.lang.IllegalArgumentException: "Object must not be null!; Message of the caused by Exception"
at...
caused by: java.lang.IllegalStateException: Message of the caused by Exception
at ...
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Remove punctuation in Exception messages #442 - GitHub
By default, Java concatenates Exception messages in a chained Exception with the ; . If punctuation is used, then this can lead to...
Read more >How to remove punctuation from a string with ... - Stack Overflow
How to remove punctuation from a string with exceptions using regex in bash · 1. tr does not use regular-expressions. It's syntax superficially ......
Read more >Removing punctuations from a given string - GeeksforGeeks
Approach: First check the input string if it consists of punctuations then we have to make it punctuation free. In order to do...
Read more >Python Program to Remove Punctuations From a String
This program removes all punctuations from a string. We will check each character of the string using for loop. If the character is...
Read more >How to remove punctuation from a string with exceptions ...
[Solved]-How to remove punctuation from a string with exceptions using regex in bash-bash ... You can specify the punctuation marks you want removed,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@martinsefcik - Thank you for bringing this to our attention. It would appear that this is the affected area of code and it could do with some more refactoring.
What we would be shooting for in this message is:
No property 'creat' found for type 'User'; Did you mean 'created'
I will look into this.
Hallo again. I just wanted to make sure that I’m fulfilling the right task. @jxblum : You want to remove have all punctuation( .;-! etc. ) at the end of all exception messages including the “test-directory”, right?