WeakAuras

WeakAuras

206M Downloads

Lua Error on Condition was breaking aura completely.

Dradux-dev opened this issue ยท 5 comments

commented

Description

My condition (remaining duration) errored with "performing arithmetic on nil value" and from that point on this weak aura had fully undefined behavior. From that point, I was not able to make the aura (state) show up at all no matter what I tried, until I reloaded the UI.

Any error in the conditions should not make break the aura at all. It's onviously an error of my code, but the error handling in this case can probably be improved anyways, to not leave you in a state, in which you don't know whats going on at all until you reload & pray.

WeakAuras Version

WeakAuras 3.7.8

World of Warcraft Flavor

Retail (Default)

Tested with only WeakAuras

  • Yes
  • No

Lua Error

No response

Reproduction Steps

  1. Create a TSU without expirationTime (or set it to nil)
  2. Enable remaining duration in variables "expirationTime = true"
  3. Check for Remaining Duration > 0 in conditions
  4. Trigger the TSU state creation (external script or whatever)
  5. Condition will fail with lua error
  6. Fix the code in the TSU
  7. Retrigger it, aura will not show at alll (but if you put a sound on any condition that is fulfilled during creation, the sound will play)
  8. Also states create in OPTIONS are not showing at all.

Last Good Version

Not tested

Screenshots

image

Export String

https://wago.io/FKubrJW-r

commented

After looking at how many places we assume that the authors of custom code don't put strings into expirationTime. I have concluded that this is a Won't fix.

commented

Please include an example aura and Lua error.

commented

Sure, I will provide soonish.

commented

Could not fully reproduce the above error, but hard forced it by assigning a string to expirationTime, which basically leads to a similiar error and the same behavior. On the wago page it is described how to reproduce it. Don't forget to uncheck "Load Never".

In the error state you can hear the condition trigger for the aura and playing a sound, while the aura itself stays invisible.

Just to avoid any confusion: I am fully aware that the error occured by a coding error of me, now even worse with hard forcing a string to expirationTime. But I still think, that WA probably can provide better error handling to hopefully be able, to recover from it, when the trigger get fixed and work as intended.

Reloading with the fixed trigger fully fixes it.

PS: Now you get already lua error on closing the editor, which I earlier not got, when the expirationTime was nil, but as mentioned I need more time to figure out how to explicitly reproduce it. But string is also a wrong type, which will be probably fixed similiar, if not with the same code at all.

commented

Reopening since the error is now reproducable.

The lua error is:
1x WeakAuras\GenericTrigger.lua:761: attempt to compare number with string
[string "@WeakAuras\GenericTrigger.lua"]:761: in function <WeakAuras\GenericTrigger.lua:759>
[string "@WeakAuras\GenericTrigger.lua"]:788: in function CreateFakeStates' [string "@WeakAuras\WeakAuras-@[email protected]"]:3759: in function UpdateFakeStatesFor'
[string "@WeakAuras\WeakAuras-@[email protected]"]:3735: in function FakeStatesFor' [string "@WeakAuras\WeakAuras-@[email protected]"]:2716: in function <WeakAuras\WeakAuras.lua:2591> [string "@WeakAuras\WeakAuras-@[email protected]"]:2736: in function Add'
[string "@WeakAurasOptions\OptionsFrames\TextEditor.lua"]:781: in function `Close'
[string "@WeakAurasOptions\OptionsFrames\TextEditor.lua"]:211: in function <WeakAurasOptions\OptionsFrames\TextEditor.lua:210>

Locals:
state =

{
show = true
duration = 60
name = "Demo 2"
autoHide = false
progressType = "timed"
changed = true
icon = 136081
expirationTime = "foobar"
}
(*temporary) = "foobar"
(*temporary) = 34869.027000
(*temporary) = "attempt to compare number with string"