mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix call expansion in debug log
Macro expansion somehow generated an error when calling a missing method with a block. ``` syntax error in :1 Error: unknown token: 'n' ``` It seems like 'n' is from the '\n' that was previously generated: ``` Log.debug { "Got undefined method " + "baz do\n yield\nend" } ```
This commit is contained in:
parent
17e97cb39a
commit
2f1999b377
1 changed files with 2 additions and 2 deletions
|
@ -124,8 +124,8 @@ module Spectator
|
||||||
# Handle all methods but only respond to configured messages.
|
# Handle all methods but only respond to configured messages.
|
||||||
# Raises an `UnexpectedMessage` error for non-configures messages.
|
# Raises an `UnexpectedMessage` error for non-configures messages.
|
||||||
macro method_missing(call)
|
macro method_missing(call)
|
||||||
Log.debug { "Got undefined method " + {{call.stringify}} }
|
Log.debug { "Got undefined method `{{call.name}}({{*call.args}}{% if call.named_args %}{% unless call.args.empty? %}, {% end %}{{*call.named_args}}{% end %}){% if call.block %} { ... }{% end %}`" }
|
||||||
args = ::Spectator::Arguments.capture({{call.args.splat(", ")}}{% if call.named_args %}{{call.named_args.splat}}{% end %})
|
args = ::Spectator::Arguments.capture({{call.args.splat(", ")}}{% if call.named_args %}{{*call.named_args}}{% end %})
|
||||||
call = ::Spectator::MethodCall.new({{call.name.symbolize}}, args)
|
call = ::Spectator::MethodCall.new({{call.name.symbolize}}, args)
|
||||||
raise ::Spectator::UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message :{{call.name}} with #{args}")
|
raise ::Spectator::UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message :{{call.name}} with #{args}")
|
||||||
nil # Necessary for compiler to infer return type as nil. Avoids runtime "can't execute ... `x` has no type errors".
|
nil # Necessary for compiler to infer return type as nil. Avoids runtime "can't execute ... `x` has no type errors".
|
||||||
|
|
Loading…
Reference in a new issue