You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a conditional statement is used inside the Try block to determine whether-or-not an exception is thrown, and that condition causes an exception to be thrown, the resulting string from the caught exception is (nil) in the Exception Handler.
To Reproduce
Enter the following snippet into a fresh E2 file (overwriting the boilerplate code in the process)...
@nameexception_handling_test
@strictif (first())
{
#SetThrow_an_exceptiontoanyvalueotherthanzerototriggeranexception, rightoffthebat.
letThrow_an_exception=1try
{
if (Throw_an_exception!=0)
{
error("An exception was throw, right off the bat.")
}
}
catch(Exception:string)
{
#TheExceptionstringisnotactuallyprinted, becauseittechnicallycontainsnothing.
print("Exception caught:")
print(Exception)
#]##[YouMAYcommentouttheprintstatementsabove, totesttheerrorpinghere.
#NOTE: TheE2willshutdown, andanobscureerrornotificationregardingstringhandlingwillshowinstead.
print("Exception caught: " +Exception)
#]#
}
}
Spawn the E2 chip somewhere.
Chat print will simply read Exception caught: with no text present where An exception was thrown, right off the bat. should be.
Alternatively, you can combine the two print() statements to look like print("Exception caught: " + Exception), and the E2 will shut down with an obscure error (see attached screenshot).
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
This error comes up when Exception is combined with any string constant.
The text was updated successfully, but these errors were encountered:
err_var.value really shouldn't be there at runtime (bind to a variable in case err_var is changed). although you'd think that would cause an error from setting a nil index..
Describe the bug
When a conditional statement is used inside the Try block to determine whether-or-not an exception is thrown, and that condition causes an exception to be thrown, the resulting string from the caught exception is
(nil)
in the Exception Handler.To Reproduce
Exception caught:
with no text present whereAn exception was thrown, right off the bat.
should be.Alternatively, you can combine the two
print()
statements to look likeprint("Exception caught: " + Exception)
, and the E2 will shut down with an obscure error (see attached screenshot).Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
This error comes up when
Exception
is combined with any string constant.The text was updated successfully, but these errors were encountered: