Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding pres about exceptions in Ruby #2

Merged
merged 1 commit into from Aug 1, 2015

Conversation

dariodaich
Copy link
Member

No description provided.

@janko
Copy link
Member

janko commented Aug 1, 2015

You received an invitation to the "BurgersTeam" group, if you accept you can push directly to the repo :)

janko added a commit that referenced this pull request Aug 1, 2015
adding pres about exceptions in Ruby
@janko janko merged commit 702d319 into rubyzg:master Aug 1, 2015

# 9 - creating custom error classes
#class HeroError < Exception; end
HeroError = Class.new(Exception)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better as HeroError = Class.new(StandardError)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

On Sat, Aug 1, 2015 at 2:47 AM, Zoran Majstorovic notifications@github.com
wrote:

In 2015-07-31/dario_ruby_exceptions.rb
#2 (comment):

+# -> common exceptions:
+# * RuntimeError - default error raise using the method |raise|
+# * NoMethodError - object can't resolve a name of the message it receives to a method.
+# * NameError - interpreter comes across an identifier it can't resolve. It can be variable name,
+# method name.
+# * IOError - error caused by trying to read a closed file, write to a read-only file etc.
+# * TypeError - method receives an argument with the wrong type.
+# * ArgumentError - method receives incorrect number of arugments.
+# -> they are all descendants of the class Exception
+#
+# Rescuing with a rescue block:
+# -> begin > rescue > end
+
+# 9 - creating custom error classes
+#class HeroError < Exception; end
+HeroError = Class.new(Exception)

better as HeroError = Class.new(StandardError) [image: ✨]


Reply to this email directly or view it on GitHub
https://github.com/rubyzg/ruby-burgers/pull/2/files#r36028165.

@dariodaich dariodaich deleted the dario_exception_prez branch August 18, 2015 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants