File: parallel_break_better_errors.rb

package info (click to toggle)
ruby-parallel 1.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 464 kB
  • sloc: ruby: 1,930; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true
require './spec/cases/helper'
require 'stringio'

class MyException < StandardError
  def initialize(object)
    super()
    @object = object
  end
end

begin
  Parallel.in_processes(2) do
    ex = Parallel::Break.new
    # better_errors sets an instance variable that contains an array of bindings.
    ex.instance_variable_set :@__better_errors_bindings_stack, [ex.send(:binding)]
    raise ex
  end
  puts "NOTHING WAS RAISED"
rescue StandardError
  puts $!.message
  puts "BACKTRACE: #{$!.backtrace.first}"
end