Thursday, August 4, 2022

[FIXED] How can I set the message on an exception in Java?

Issue

I want to set a custom exception message. However, I'm unsure of how to do this. Will I need to create a custom exception class or is there an easier way of doing this?


Solution

Well, if the API offers an exception that suits your needs (IllegalArgumentException for example), just use it and pass your message in the constructor.



Answered By - quaylar
Answer Checked By - Robin (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.