In a proc, with static variables, I have somewhere:
except SomeError as e:
when not staticVarOn:
raise e
else:
discard
This obviously leads to 2 different versions of the proc: one (when staticVarOn is true) re-raising SomeError and another one, doing nothing.
And it's that last one, I guess, that leads to the following hint (and the accompanying generated code):
Hint: 'e' is declared but not used [XDeclaredButNotUsed]
I have tried wrapping the whole except clause inside the when .. else construct, but it keeps looking for an except.
Any idea how to altogether-avoid the except clause when staticVarOn is set?
If all you're doing is reraising, you don't need the exception variable.
except SomeError:
when not staticVarOn:
raise
else:
discard
Worst case you can discard e.
Spot on! Thanks a lot!
For some reason, I took it for granted that raise expected a param, but - apparently - it doesn't.
Thanks again! :)