There will be no difference as an undo operation will only revert changes to the drawing database & system variables, it will not change variable values.
Either may be used, but personally I prefer to declare the *error* symbol local to the function such that any redefinition is restored outside of the function scope.