Improve error handling in ArchiveExtractor by catching ValueError during zip archive closure
This commit is contained in:
parent
ead20f7924
commit
ccb1ef6971
2 changed files with 13 additions and 2 deletions
|
@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.1.7] - Ongoing
|
||||
## [2.1.7] - 2025-03-17
|
||||
|
||||
This update introduces a quality of life improvement
|
||||
|
||||
|
@ -13,6 +13,9 @@ This update introduces a quality of life improvement
|
|||
- Refactor variable names for consistency and clarity in ShutdownHandler and PackageWriter classes
|
||||
- Improve error handling in ShutdownHandler by logging warnings for cleanup failures
|
||||
|
||||
### Fixed
|
||||
- Fixed issue in ArchiveExctractor where close() may be called on a already closed resource
|
||||
|
||||
|
||||
## [2.1.6] - 2024-10-29
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
use ncc\Utilities\Console;
|
||||
use PharData;
|
||||
use RuntimeException;
|
||||
use ValueError;
|
||||
use ZipArchive;
|
||||
|
||||
class ArchiveExtractor
|
||||
|
@ -126,6 +127,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
$zip_archive->close();
|
||||
try
|
||||
{
|
||||
$zip_archive->close();
|
||||
}
|
||||
catch(ValueError $e)
|
||||
{
|
||||
Console::outWarning('An error occurred while closing the zip archive, ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue