Menu

#7 Log.error(...) could've taken Throwable

open
None
5
2000-04-26
2000-03-09
No

Currently, the grace.log.Log declares the error(...) methods with Exception. But, Exception doesn't cover everything that can be caught, unlike Throwable. I'd suggest you change the method declaration to Throwable.

Also, EventFormat.java:773 could easily throw the ClassCastException if you use something Throwable, but not Exception, in Log.error(String, Object), if I'm not mistaken.

Also, EventFormat.format* could use a dispatcher pattern and handlers for some specific classes of objects:

getHandlerByClass(object.getClass()).handle(object);

;)

Discussion

  • Christopher Bladon

    • assigned_to: nobody --> cbladon
    • status: Error - status not found --> open
     
  • Christopher Bladon

    Agreed. The use of Exception instead of Throwable is historical but I can't come up with a good reason why it is there and why not to change it. :)

    I'll make the change ASAP.

     

Log in to post a comment.