Module: Superscript

Defined in:
lib/superscript.rb,
lib/superscript/ctx.rb,
lib/superscript/dsl.rb,
lib/superscript/runner.rb,
lib/superscript/version.rb

Defined Under Namespace

Classes: Ctx, Dsl, Error, Runner

Constant Summary collapse

VERSION =
"0.4.2"

Class Method Summary collapse

Class Method Details

.error(where, *args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/superscript/runner.rb', line 2

def self.error(where, *args)
  puts "-- [ superscript error ] --"
  error_message = ""
  case where
  when :exception
    exception = args.first
    pp exception
    pp exception.backtrace_locations
    error_message = exception
  when :ctx_method_missing, :tp_singleton_method_added, :tp_command_not_found
    error_message = args.first
  when :tp_class_define, :tp_module_define
    error_message = args.first
  else
    pp [:unknown_where, where, args]
    error_message = args.join(" ")
  end

  puts error_message
  if ENV["SUPERSCRIPT_ERROR_EXEC"]
    error_exec_pid = spawn ENV["SUPERSCRIPT_ERROR_EXEC"], error_message
    Process.wait error_exec_pid
  end
  exit 1
end