I am trying to handle an error coming in a result of an HTTPoison.request!
with
try do
%{"session_id" => session_id} = ElixirDropbox.Files.UploadSession.start(client, true, image_save_path)
write_sessional_values(session_id, file_size, "/#{construction}/#{camera_exid}/#{id}/#{starting}.jpg", path)
check_1000_chunk(path) |> length() |> commit_if_1000(client, path)
rescue
_ ->
:timer.sleep(:timer.seconds(3))
upload(200, response, starting, camera_exid, id, requestor)
end
my question is: I am totally ignoring the exception in rescue and doing the operation again which I want to do.
same as in with..
with {:ok, file_size} <- get_file_size(image_save_path),
%{"session_id" => session_id} <- ElixirDropbox.Files.UploadSession.start(client, true, image_save_path) do
write_sessional_values(session_id, file_size, "/#{construction}/#{camera_exid}/#{id}/#{starting}.jpg", path)
check_1000_chunk(path) |> length() |> commit_if_1000(client, path)
else
_ ->
:timer.sleep(:timer.seconds(3))
upload(200, response, starting, camera_exid, id, requestor)
end
I am totally ignoring what is coming in else part in with
what are the solid grounds here to use both in which cases?