On Fri, 2005-09-02 at 00:09 +0800, Niclas Hedhman wrote:
> Even better if the offending caller's identity is extracted, reformatted for 
> human consumption and placed as the argument in the exception thrown;
> 
> java.lang.IllegalArgumentException: The class org.niclas.hedhman.SomeCode 
> passed a null argument for the third parameter ("history") on line 263, to 
> the computeHealthStatus() method in class org.clinic.HealthAssessment.

Using a good pattern in conjonction with slf4j could help a lot :

if (arg == null)
    {
    log.error("the third parameter ('history') is null");
    throw new IAE(<a message>);
    }
...

As you can exhibit the method name and the line number with %C and %L,
it increases the message correctness.

Emmanuel


Reply via email to