Skip to content

Commit c9361b1

Browse files
committed
error message for exec_with_timeout changed
1 parent 80b1e8b commit c9361b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def print_string(string)
171171
end
172172
end
173173

174-
def exec_with_timeout(sec)
174+
def exec_with_timeout(sec, error_message)
175175
return yield if sec == nil or sec.zero?
176176
if Thread.respond_to?(:critical) and Thread.critical
177177
raise ThreadError, "timeout within critical session"
@@ -180,7 +180,7 @@ def exec_with_timeout(sec)
180180
x = Thread.current
181181
y = DebugThread.start {
182182
sleep sec
183-
x.raise SimpleTimeLimitError.new("Timeout: evaluation took longer than #{sec} seconds.") if x.alive?
183+
x.raise SimpleTimeLimitError.new(error_message) if x.alive?
184184
}
185185
yield sec
186186
ensure
@@ -190,7 +190,7 @@ def exec_with_timeout(sec)
190190

191191
def exec_with_allocation_control(value, memory_limit, time_limit, exec_method, overflow_message_type)
192192
return value.send exec_method if !Debugger.trace_to_s
193-
return exec_with_timeout(time_limit * 1e-3) {value.send exec_method} if defined?(JRUBY_VERSION) || memory_limit <= 0 || (RUBY_VERSION < '2.0' && time_limit > 0)
193+
return exec_with_timeout(time_limit * 1e-3, "Timeout: evaluation of #{exec_method} took longer than #{time_limit}ms.") {value.send exec_method} if defined?(JRUBY_VERSION) || memory_limit <= 0 || (RUBY_VERSION < '2.0' && time_limit > 0)
194194

195195

196196
curr_thread = Thread.current

0 commit comments

Comments
 (0)