From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Logging exceptions

Logging exceptions - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Logging exceptions

- [Instructor] Planning for good exception management is complex. A good practice is to have a generalized handler that catches all unexpected exceptions. Ideally, this would be a global handler. For this demonstration, we'll look at a simpler local implementation. The code that we're looking at here is very similar to the last demo, except I've added this line 11. And what we're doing here is calling three potential methods that could cause problems: get data from list, open file, and work with numbers. And I've written some specific exception handlers, one for file not found and one for overflow exception and this one down here catches everything else. We deploy our application and it turns out there's another issue that we didn't plan for. It's this. When I click on this button, I'm getting, "Something went wrong. "Index without a range. "Must be a non-negative and less than the size "of the collection." What's…

Contents