stdVBA icon indicating copy to clipboard operation
stdVBA copied to clipboard

`stdError` wrapping - duplicate errors.

Open sancarn opened this issue 5 months ago • 0 comments

A common technique is:

if someCondition then Err.Raise 1, "", "..."

This is because Err.Raise will automatically jump up the stack to the handler. However when we change this to:

if someCondition then stdErr.Raise "..."

This won't necessarily jump up the stack to the handler (especially in codebases that log instead of throwing altogether). It would be valuable to change all these to:

if someCondition then
  stdError.Raise "..."
  Exit Sub/Exit Function/Exit Property
End if

sancarn avatar Jul 27 '25 00:07 sancarn