Catch exceptions in HTML tag when attempting to convert to a string