Skip to content

Commit

Permalink
fix DataServiceModel(id)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Jul 14, 2023
1 parent f8c7083 commit 26e2ef0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/SimulationService.jl
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,13 @@ function DataServiceModel(id::String)
end
check = (_, e) -> e isa HTTP.Exceptions.StatusError && ex.status == 404
delays = fill(1, TDS_RETRIES)
obj = try
retry(() -> get_json("$TDS_URL/simulations/$id"); delays, check)()

try
m = retry(() -> JSON3.read(download("$TDS_URL/simulations/$id")); delays, check)()
return m
catch
nothing
return error("No simulation found in TDS with id=$id.")
end
isnothing(obj) ?
error("No simulation found in TDS with id=$id.") :
JSON3.read(obj, DataServiceModel)
end

function get_model(id::String)
Expand Down

0 comments on commit 26e2ef0

Please sign in to comment.