Skip to content

Commit 59d7c03

Browse files
committed
Refactor Truffle::ExceptionOperations.full_message and pass options as keyword arguments
1 parent 5813d89 commit 59d7c03

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/main/ruby/truffleruby/core/exception.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def inspect
7878
end
7979

8080
def full_message(**options)
81-
Truffle::ExceptionOperations.full_message(self, options)
81+
Truffle::ExceptionOperations.full_message(self, **options)
8282
end
8383

8484
def detailed_message(highlight: nil, **options)

src/main/ruby/truffleruby/core/truffle/exception_operations.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def self.detailed_message_fallback(exception, options)
159159
end
160160
end
161161

162-
def self.full_message(exception, options)
162+
def self.full_message(exception, **options)
163163
highlight = options[:highlight]
164164
highlight = if Primitive.nil?(highlight)
165165
Exception.to_tty?
@@ -168,14 +168,13 @@ def self.full_message(exception, options)
168168
!Primitive.false?(highlight)
169169
end
170170

171+
options[:highlight] = highlight
172+
171173
order = options[:order]
172174
order = :top if Primitive.nil?(order)
173175
raise ArgumentError, "expected :top or :bottom as order: #{order}" unless Primitive.equal?(order, :top) || Primitive.equal?(order, :bottom)
174176
reverse = !Primitive.equal?(order, :top)
175177

176-
options = options.dup
177-
options[:highlight] = highlight
178-
179178
result = ''.b
180179
bt = exception.backtrace || caller(2)
181180
if reverse
@@ -290,8 +289,8 @@ def self.to_class_name(val)
290289
end
291290
end
292291

293-
def self.get_formatted_backtrace(exc)
294-
full_message(exc, nil, :top)
292+
def self.get_formatted_backtrace(exception)
293+
full_message(exception, highlight: nil, order: :top)
295294
end
296295

297296
def self.comparison_error_message(x, y)

0 commit comments

Comments
 (0)