diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index 708004fa1..95b522d41 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -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);