Skip to content

Commit

Permalink
close dataset on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Nov 16, 2017
1 parent 099e1fc commit a5e4553
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/NCDatasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,12 @@ end

function Dataset(f::Function,args...; kwargs...)
ds = Dataset(args...; kwargs...)
f(ds)
try
f(ds)
catch
close(ds)
rethrow()
end
close(ds)
end

Expand Down

0 comments on commit a5e4553

Please sign in to comment.