mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Catch errors while evaluating node labels
This commit is contained in:
parent
4a0bfc1cb2
commit
6a5e5b8f7a
2 changed files with 10 additions and 2 deletions
|
@ -125,7 +125,11 @@ module Spectator::DSL
|
||||||
{% if what.is_a?(StringLiteral) || what.is_a?(NilLiteral) %}
|
{% if what.is_a?(StringLiteral) || what.is_a?(NilLiteral) %}
|
||||||
{{what}}
|
{{what}}
|
||||||
{% elsif what.is_a?(StringInterpolation) %}
|
{% elsif what.is_a?(StringInterpolation) %}
|
||||||
{{@type.name}}.new.eval { {{what}} }
|
{{@type.name}}.new.eval do
|
||||||
|
{{what}}
|
||||||
|
rescue e
|
||||||
|
"<Failed to evaluate example label - #{e.class}: #{e}>"
|
||||||
|
end
|
||||||
{% else %}
|
{% else %}
|
||||||
{{what.stringify}}
|
{{what.stringify}}
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
|
@ -137,7 +137,11 @@ module Spectator::DSL
|
||||||
what.is_a?(NilLiteral) %}
|
what.is_a?(NilLiteral) %}
|
||||||
{{what}}
|
{{what}}
|
||||||
{% elsif what.is_a?(StringInterpolation) %}
|
{% elsif what.is_a?(StringInterpolation) %}
|
||||||
{{@type.name}}.new.eval { {{what}} }
|
{{@type.name}}.new.eval do
|
||||||
|
{{what}}
|
||||||
|
rescue e
|
||||||
|
"<Failed to evaluate context label - #{e.class}: #{e}>"
|
||||||
|
end
|
||||||
{% else %}
|
{% else %}
|
||||||
{{what.stringify}}
|
{{what.stringify}}
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
Loading…
Reference in a new issue