Weather Control ver 1.8
Shannon Hager pointed out that my weather control was vulnerable to exceptions thrown as a result of DNS resolution and other network errors. Up until now the control would throw an exception from its template constructor and you would have no chance to handle it. Granted, you should always use custom error pages, but the weather control would take down the entire page.
I’ve added an event,
Error, which you can wire server-side. I’m providing this event so that the user sees a friendly message, and the developer has a chance to trap the exception and do something about it. What I do is I email to myself the error message and the entire stack trace.
It’s very easy to add an error event handler. Check control’s documentation and see the accompanying sample.
From now on, if the control can’t connect to weather.com or encounters some other problem upon initialization, it would simply write out Weather forecast is not available at this time. The page itself remains functional, and the control doesn’t blow up anything.
Please, download the latest binaries and source code. If you only use the compiled assembly simply replace the old one.