Do you use resource file to store all the messages and globlal strings?
Updated by Tiago Araújo [SSW] 3 years ago. See history
123
No component provided for introEmbed
Catch(SqlNullValueException sqlex){Response.Write("The value cannot be null.");}
❌ Figure: Bad example - If you want to change the message, it will cost you lots of time to investigate every try-catch block
Catch(SqlNullValueException sqlex){Response.Write(GetGlobalResourceObject("Messages", "SqlValueNotNull"));}
😐 Figure: OK example - Better than the hard code, but still wordy
Catch(SqlNullValueException sqlex){Response.Write(Resources.Messages.SqlValueNotNull); 'Good Code - storing message in resource file.}
✅ Figure: Good example
Categories
Related rules
Need help?
SSW Consulting has over 30 years of experience developing awesome software solutions.