Skip to content

Commit 613870e

Browse files
committed
more informative error message when output container does not exist
1 parent 212b4c9 commit 613870e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/AzStorage.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,10 @@ cp(AzContainer("mycontainer";storageaccount="mystorageaccount"), "remoteblob_in.
749749
```
750750
"""
751751
function Base.cp(in::AbstractString, outc::AzContainer, outb::AbstractString; buffersize=2_000_000_000, show_progress=false)
752+
if !isdir(outc)
753+
error("output container '$outc' does not exist. use `mkpath to create it.")
754+
end
755+
752756
if Sys.iswindows()
753757
bytes = read!(in, Vector{UInt8}(undef, filesize(in)))
754758
write(outc, outb, bytes)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ end
502502
write("foolocal.txt", "Hello world")
503503
r = uuid4()
504504
c = AzContainer("foo-$r-o", storageaccount=storageaccount, session=session, nthreads=2, nretry=10)
505+
@test_throws "does not exist" cp("foolocal.txt", c, "foo.txt")
505506
robust_mkpath(c)
506507
cp("foolocal.txt", c, "foo.txt")
507508
@test read(c, "foo.txt", String) == "Hello world"

0 commit comments

Comments
 (0)