Sha256: 8d534344a7a0d6090eba16a3d2c1c4704debf6d99f40c7a12a17a489a780cd69

Contents?: true

Size: 484 Bytes

Versions: 6

Compression:

Stored size: 484 Bytes

Contents

class SpecificExampleException < StandardError; end

class OtherCustomException < StandardError; end

def exception_list
  [SpecificExampleException, OtherCustomException]
end

describe "The rescue keyword" do
  it "can be used to handle a specific exception"
  
  it "can capture the raised exception in a local variable" do
    begin
      raise SpecificExampleException, "some text"
    rescue SpecificExampleException => e
      e.message.should == "some text"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-0.3.2 gems/core/spec/language/rescue_spec.rb
opal-0.3.1 gems/core/spec/language/rescue_spec.rb
opal-0.3.0 gems/core/spec/language/rescue_spec.rb
opal-0.2.2 opals/opal/opal/spec/language/rescue_spec.rb
opal-0.2.0 opals/opal/opal/spec/language/rescue_spec.rb
opal-0.1.0 opals/opal/spec/language/rescue_spec.rb