Error message using H5AOpen

I am using H5AOpen to open an attribute that some times exists but other times it does not. I understand that when the attribute does not exist, then H5AOpen returns a negative number. It does so, but it writes this message:

HDF5-DIAG: Error detected in HDF5 (1.8.5-patch1) thread 0:
#000: …\src\H5A.c line 546 in H5Aopen(): unable to load attribute info from object header
major: Attribute
minor: Unable to initialize object
#001: …\src\H5Oattribute.c line 529 in H5O_attr_open_by_name(): can’t locate attribute
major: Attribute
minor: Object not found

How can I do to avoid this message?

Thanks a lot