Exception: RemoteRuby::RemoteError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/remote_ruby/remote_error.rb

Overview

Raised when an error occurs during remote execution Wraps the original error and provides additional information about the error and the source code that caused it. Allows to display the source code around the line that caused the error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code_source, remote_context, source_path) ⇒ RemoteError

Returns a new instance of RemoteError.



12
13
14
15
16
17
18
# File 'lib/remote_ruby/remote_error.rb', line 12

def initialize(code_source, remote_context, source_path)
  @code_source = code_source
  @remote_context = remote_context
  @source_path = source_path
  @stack_trace_regexp = /^#{Regexp.escape(remote_context.file_name)}:(?<line_number>\d+):in (?<method_name>.*)$/
  super(build_message)
end

Instance Attribute Details

#code_sourceObject (readonly)

Returns the value of attribute code_source.



10
11
12
# File 'lib/remote_ruby/remote_error.rb', line 10

def code_source
  @code_source
end

#remote_contextObject (readonly)

Returns the value of attribute remote_context.



10
11
12
# File 'lib/remote_ruby/remote_error.rb', line 10

def remote_context
  @remote_context
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



10
11
12
# File 'lib/remote_ruby/remote_error.rb', line 10

def source_path
  @source_path
end

#stack_trace_regexpObject (readonly)

Returns the value of attribute stack_trace_regexp.



10
11
12
# File 'lib/remote_ruby/remote_error.rb', line 10

def stack_trace_regexp
  @stack_trace_regexp
end