This utility function checks if an error exists and, if so, appends it to the provided error list.
Arguments
- errors
A list object that contains the current errors.
- err
An error object to be added to the error list. It can be NULL, in which case no action is taken.
Value
The updated errors list.