Join Kevin Skoglund for an in-depth discussion in this video Raise exceptions, part of Ruby: Classes and Modules.
- [Instructor] In this movie,…we're going to learn how to raise exceptions.…We've already seen how Ruby will raise exceptions…when something goes wrong in our code,…but we don't have to wait and let Ruby do it.…We can actually do it intentionally in our code.…We can do that using…either Ruby's built-in exception classes…or we can define custom exceptions.…We're going to look at custom exceptions in the next movie.…For now, let's start out by looking…at Ruby's built-in exception classes.…Remember that there's an exception class…defined in the Ruby documentation,…and it has a list of all of these sub-classes…that are available to us.…
We have the ability…to raise any one of these built-in errors ourself.…Notice also that there's a little note here…next to runtime error,…that it's the default for raise.…We're going to be using raise,…and when we do, the default will be runtime error,…so let's just remember that.…But you can look through these…and pick out any one you want,…so if you wanted to raise a type error,…if you wanted to raise an argument error,…
- Defining a custom class
- Working with instances of a class
- Class and instance attributes and methods
- Class inheritance
- Working with dates and times
- Using modules as namespaces and mixins
- Raising and handling exceptions
Skill Level Beginner
2. Class Attributes and Methods
4. Dates and Times
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.