Back in my days doing Java I used to create a custom exception class for about everything that could go wrong in the application, like PlayerNotFoundException, CommandExecutionFailedException, MissingFieldException, RedditIsDownException, you call it. In the exception message I would put what data caused the exception and, if applicable, how to correct it.
In the code, you can simply catch the type of exceptions you are interested and react accordingly, and when you read a stacktrace saying my.app.PlayerNotFoundException: couldn't find player with id '-1' it's quite easy to diagnose what went wrong.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You may be right and it's just that simple. Perhaps I am thinking too much in the context of Java which is usually about as human-friendly as a brick.
Back in my days doing Java I used to create a custom exception class for about everything that could go wrong in the application, like
PlayerNotFoundException
,CommandExecutionFailedException
,MissingFieldException
,RedditIsDownException
, you call it. In the exception message I would put what data caused the exception and, if applicable, how to correct it.In the code, you can simply catch the type of exceptions you are interested and react accordingly, and when you read a stacktrace saying
my.app.PlayerNotFoundException: couldn't find player with id '-1'
it's quite easy to diagnose what went wrong.