Skip to content

Commit

Permalink
keep try/finally, always throw
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Sep 8, 2023
1 parent 8e33c0c commit 71731ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/api/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ macro h5error(msg)
# evaluating the message expression, as some message expressions can call API
# functions, which would clear the error stack.
quote
err_id = h5e_get_current_stack()
if h5e_get_num(err_id) > 0
err_id = -1 #h5e_get_current_stack()
#if h5e_get_num(err_id) > 0
throw(H5Error($(esc(msg)), err_id))
else
h5e_close_stack(err_id)
end
#else
# h5e_close_stack(err_id)
#end
end
end

Expand Down
6 changes: 3 additions & 3 deletions src/api/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ See `libhdf5` documentation for [`H5Aiterate2`](https://docs.hdfgroup.org/hdf5/v
"""
function h5a_iterate(obj_id, idx_type, order, n, op, op_data)
lock(liblock)
var"#status#" = #try
var"#status#" = try
ccall((:H5Aiterate2, libhdf5), herr_t, (hid_t, Cint, Cint, Ptr{hsize_t}, Ptr{Cvoid}, Any), obj_id, idx_type, order, n, op, op_data)
#finally
finally
unlock(liblock)
#end
end
# @show var"#status#"
var"#status#" < herr_t(0) && @h5error(string("Error iterating attributes in object ", h5i_get_name(obj_id)))
return nothing
Expand Down

0 comments on commit 71731ff

Please sign in to comment.