correct error detection code in export
This commit is contained in:
parent
247166baf2
commit
62cb3a4b9c
1 changed files with 5 additions and 4 deletions
|
|
@ -791,14 +791,15 @@ sub exportWriteFile {
|
|||
my $dest = $self->exportGetUrlAsPath;
|
||||
my $parent = $dest->parent;
|
||||
|
||||
eval { $parent->absolute->mkpath };
|
||||
if($@) {
|
||||
WebGUI::Error->throw(error => "could not make directory " . $parent->absolute->stringify);
|
||||
$parent->absolute->mkpath( {error => \my $err} );
|
||||
if (@$err) {
|
||||
(undef, my $message) = %{ $err->[0] };
|
||||
WebGUI::Error->throw(error => "Could not make directory " . $parent->absolute->stringify . ": " . $message);
|
||||
}
|
||||
|
||||
# next, get the contents, open the file, and write the contents to the file.
|
||||
my $fh = eval { $dest->open('>:utf8') };
|
||||
if($@) {
|
||||
if(! $fh) {
|
||||
WebGUI::Error->throw(error => "can't open " . $dest->absolute->stringify . " for writing: $!");
|
||||
}
|
||||
$self->session->asset($self);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue