Update ErrorHandler.cs

Updated the ErrorHandler utility class with comments + optimizations.