Course Content

Course Content


Ruby's technique of dealing with unforeseen events is through exceptions. You've seen exceptions in action if you've ever committed an error in your code, causing your application to crash with a message like SyntaxError or NoMethodError. When you throw a Ruby exception, the world comes to a halt and your software begins to shut down.

An exception is an unwelcome or unexpected occurrence that occurs during the execution of a program, i.e. at runtime, and disturbs the program's usual flow of instructions. In Ruby, descendants of the Exception class are used to connect raise methods to rescue statements in the begin and end blocks.

  • Create a brand new class. Exceptions, like everything else in Ruby, are classes!
  • Type a message in the box. A message attribute exists on every Ruby exception object.
  • To your exception, add a new data attribute. You can add custom data to your exception in the same way that you would to any other class.

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere