Locked lesson.
About this lesson
In this lesson, we identify a helpful Exception List that can help educate you on potential issues that could impact your code.
Quick reference
Exception Lists
Google "C# exception list" or check out the Exception list here:
https://www.completecsharptutorial.com/basic/complete-system-exception.php
When to use
Check out the exception list every now and then to familiarize yourself with them.
Instructions
It's a good idea to familiarize the Exceptions, at least until you get a good feel for them.
Hints & tips
- You do not need to memorize all the Exceptions!
- 00:04 Okay, a couple of videos ago, I showed you how to catch specific exceptions and
- 00:08 that's super useful.
- 00:09 And I also showed you how to find the exception that you can expect to happen by
- 00:14 actually just pulling up.
- 00:16 In this case, we can pull up exception e, right??
- 00:21 And then inside of here, instead of having text, we could just type in e here, and
- 00:26 this will print out the exception to the screen.
- 00:29 And that's what you're going to want to do most of the time.
- 00:31 But if you want to learn more about these exceptions, if you want to learn what they
- 00:35 are and different things you can do about them, you really need a resource to kind
- 00:39 of, at a glance, look at all the exceptions or to easily look them up.
- 00:43 And of course, you can Google this at any time.
- 00:45 But there's a couple of resources, one specifically I want to show you that
- 00:49 really just lists out all of the exceptions onto the screen.
- 00:53 And there are just many, many as we'll see and
- 00:55 they also have little descriptions for each one.
- 00:57 So it's a nice little resource to, if you get hung up on any of this stuff,
- 01:01 want to learn more, need to learn more.
- 01:03 It's a great place to look.
- 01:04 So let's head over to Google.
- 01:05 And these websites come and go.
- 01:07 So I'm not going to give you the address right away.
- 01:08 I'm just going to show you how I would find this on my own here.
- 01:12 So I go to Google, I would type in C# exception list.
- 01:18 And then when you do that, you get all kinds of things,
- 01:21 and you might think to go to the Microsoft page, right?
- 01:23 Microsoft created C# and all of this stuff.
- 01:26 But if you do, it's not all that useful.
- 01:30 You can kind of click around here, not great.
- 01:33 So I don't recommend that Microsoft docs.
- 01:37 What I might recommend is this next one listed,
- 01:39 it's the completecsharptutorial.com, click on this.
- 01:43 And here, we've got exceptions and the conditions,
- 01:46 sort of a little description of each one.
- 01:49 And you could see, man, there's dozens of these things..
- 01:53 So I'm not entirely sure this is an extensive list,
- 01:58 but it is a pretty good list.
- 02:01 And as far as I can tell, one of the bigger lists out there.
- 02:04 So we can come through here and just kind of look at some of these.
- 02:07 AccessViolation, AggregateException, and
- 02:10 why is it important to kind of read through these and look at these.
- 02:13 Well, you're just getting started.
- 02:15 You don't really know the types of errors and
- 02:17 exceptions you're going to come up against as a coder.
- 02:20 And I showed you a couple of videos how to find specific exceptions in your
- 02:24 specific code.
- 02:25 But you may not even know there could be an exception in a certain case, right?
- 02:30 So it's just a good idea to come through here and just spend a few minutes sort of
- 02:34 reading these things, and maybe something will stick.
- 02:37 And as you're writing code, you'll remember away, wait,
- 02:39 wasn't there an ArgumentException?
- 02:41 Yeah, there was, go back and look it up, and
- 02:44 it's thrown when invalid argument provided to a method, right?
- 02:47 So not a huge description here, but enough to sort of send you on the right track and
- 02:52 maybe Google something else in more detail later on.
- 02:54 So ArithmeticException, ArgumentOutOfRangeException.
- 03:00 We had that one, didn't we?
- 03:01 I think we did.
- 03:02 Yeah, an argument is outside the allowable range.
- 03:05 BadImageFormatException if you're dealing with images, I guess.
- 03:10 Let's see, what else, what's interesting through here.
- 03:12 DivideByZeroException, there's the one we had earlier.
- 03:15 It's thrown in there as an attempt to divide an integral or
- 03:18 decimal value by zero.
- 03:20 Okay, we know that from math back in grade school or whatever.
- 03:24 DllNotFound, that's interesting.
- 03:26 FormatException, I think we had that one too, right?
- 03:29 Other IndexOutOfRange, what was the other one?
- 03:32 But like I said, come through here and just read through all these.
- 03:36 I would really spend 10 minutes or so just reading all of these and the descriptions.
- 03:42 Like I said, you're not going to memorize all these.
- 03:44 You shouldn't memorize all of them, but it's a good idea to just sort of
- 03:47 familiarize yourselves with them if nothing else.
- 03:49 StackOverflowException, that's a good one, right?
- 03:53 TimeoutException, IO Exceptions, input, output, right?
- 03:57 Interesting, very cool.
- 03:59 Like I said, this is not an extensive list, I don't think, but it's a really
- 04:03 good place to start, sort of familiarize yourself with these exceptions.
- 04:06 And it's just good fun to nerd out on this stuff, right?
- 04:10 So that's all for this video.
- 04:11 In the next video, we'll start to look at classes.
Lesson notes are only available for subscribers.