Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Please define a single base error. #125

Closed
ushis opened this Issue · 1 comment

2 participants

@ushis

Please define a single base error. At the moment there are two root exceptions:

# lib/psych.rb
RuntimeError > Psych::Exception > Psych::BadAlias

# lib/psych/syntax_error.rb
RuntimeError > Psych::Error > Psych::SyntaxError

If i want to catch all Psych errors, i have to write:

require 'psych'
require 'psych/syntax_error'

begin
  Psych.load(yaml)
rescue Psych::Exception, Psych::Error => e
  omg e
end

It would be way nicer to just require 'psych' and rescue Psych::Error.

@sheerun

+1

@tenderlove tenderlove referenced this issue from a commit
@tenderlove * ext/psych/lib/psych/exception.rb: there should be only one exception
  base class. Fixes tenderlove/psych #125
* ext/psych/lib/psych.rb: require the correct exception class
* ext/psych/lib/psych/syntax_error.rb: ditto
* ext/psych/lib/psych/visitors/to_ruby.rb: ditto

fixes #125
803653a
@tenderlove tenderlove closed this issue from a commit
@tenderlove * ext/psych/lib/psych/exception.rb: there should be only one exception
  base class. Fixes tenderlove/psych #125
* ext/psych/lib/psych.rb: require the correct exception class
* ext/psych/lib/psych/syntax_error.rb: ditto
* ext/psych/lib/psych/visitors/to_ruby.rb: ditto

fixes #125
803653a
@tenderlove tenderlove closed this in 803653a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.