my $cache = io($cache_name);
if (-f $cache_name) {
if ($cache->mtime >= $io->mtime) {
- return $self->_new_page($path, $self->_json->decode($cache->all));
+ return try {
+ $self->_new_page($path, $self->_json->decode($cache->all));
+ } catch {
+ die "Error inflating ${path} from cache: $_\n";
+ }
}
}
my $raw = $io->all;
try {
my $extracted = $self->${\"_extract_from_${type}"}($raw);
- $cache->print($self->_json->encode($extracted));
+ try { $cache->print($self->_json->encode($extracted)); };
$self->_new_page($path, $extracted);
} catch {
- die "Error inflating ${path} as ${type}: $_\n\nData was: ${raw}";
+ die "Error inflating ${path} as ${type}: $_\n";
}
}