diff --git a/src/HDF5.jl b/src/HDF5.jl index 560018d6a..fccc3572e 100644 --- a/src/HDF5.jl +++ b/src/HDF5.jl @@ -1966,21 +1966,6 @@ function create_external(source::Union{File,Group}, source_relpath, target_filen nothing end -# error handling -function silence_errors(f::Function) - estack = H5E_DEFAULT - func, client_data = h5e_get_auto(estack) - h5e_set_auto(estack, C_NULL, C_NULL) - try - return f() - finally - h5e_set_auto(estack, func, client_data) - end -end - -# Define globally because JLD uses this, too -const rehash! = Base.rehash! - # Across initializations of the library, the id of various properties # will change. So don't hard-code the id (important for precompilation) const UTF8_LINK_PROPERTIES = Ref{Properties}() diff --git a/src/api_midlevel.jl b/src/api_midlevel.jl index 4a66ded12..923f1b5cd 100644 --- a/src/api_midlevel.jl +++ b/src/api_midlevel.jl @@ -45,3 +45,19 @@ function get_extent_dims(obj::Union{Dataspace,Dataset,Attribute}) obj isa Dataspace || close(dspace) return dims, maxdims end + +""" + silence_errors(f::Function) + +During execution of the function `f`, disable printing of internal HDF5 library error messages. +""" +function silence_errors(f::Function) + estack = H5E_DEFAULT + func, client_data = h5e_get_auto(estack) + h5e_set_auto(estack, C_NULL, C_NULL) + try + return f() + finally + h5e_set_auto(estack, func, client_data) + end +end