Skip to content

Commit 82ff29e

Browse files
committed
extract common superclass from TL&ML Errors
1 parent 4e632da commit 82ff29e

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module OverflowMessageType
1313
SPECIAL_SYMBOL_MESSAGE = lambda {|e| '<?>'}
1414
end
1515

16-
class MemoryLimitError < StandardError
16+
class ExecError < StandardError
1717
attr_reader :message
1818
attr_reader :trace_point
1919
attr_reader :backtrace
@@ -25,17 +25,9 @@ def initialize(message, trace_point, backtrace = [])
2525
end
2626
end
2727

28-
class TimeLimitError < StandardError
29-
attr_reader :message
30-
attr_reader :trace_point
31-
attr_reader :backtrace
28+
class MemoryLimitError < ExecError; end
3229

33-
def initialize(message, trace_point, backtrace = [])
34-
@message = message
35-
@trace_point = trace_point
36-
@backtrace = backtrace
37-
end
38-
end
30+
class TimeLimitError < ExecError; end
3931

4032
class XmlPrinter # :nodoc:
4133
class ExceptionProxy
@@ -205,7 +197,7 @@ def exec_with_allocation_control(value, memory_limit, time_limit, exec_method, o
205197
end
206198
inspect_thread.join
207199
return result
208-
rescue MemoryLimitError, TimeLimitError => e
200+
rescue ExecError => e
209201
e.trace_point.disable
210202
print_debug(e.message + "\n" + e.backtrace.map {|l| "\t#{l}"}.join("\n"))
211203
return overflow_message_type.call(e)

0 commit comments

Comments
 (0)