Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/oce-import-codes
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ try {
$application->add(new ImportCodesCommand());
$application->setDefaultCommand('import', true);
$application->run();
} catch (Exception $e) {
} catch (Throwable $e) {
echo "Error: " . $e->getMessage() . "\n";
exit(1);
}
2 changes: 1 addition & 1 deletion build.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
echo " Size: " . number_format(filesize($pharFile)) . " bytes\n";
echo " Usage: ./build/oce-import-codes.phar RXNORM /path/to/rxnorm.zip --openemr-path=/var/www/openemr\n";

} catch (Exception $e) {
} catch (Throwable $e) {
echo "❌ Error building PHAR: " . $e->getMessage() . "\n";
exit(1);
}
6 changes: 3 additions & 3 deletions src/Command/ImportCodesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Initialize OpenEMR connection
try {
$this->connector->initialize($openemrPath, $site);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$this->logJson('error', 'Failed to initialize OpenEMR connection', ['error' => $e->getMessage()]);
return Command::FAILURE;
}
Expand Down Expand Up @@ -359,7 +359,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->logJson('success', 'Import completed successfully');
return Command::SUCCESS;
} catch (\Exception $e) {
} catch (\Throwable $e) {
$this->logJson('error', 'Import failed', ['error' => $e->getMessage()]);

// Cleanup on error
Expand All @@ -383,7 +383,7 @@ private function performImport(
if (!$dryRun) {
try {
$this->importer->import($codeType, $isWindows, $usExtension, $filePath);
} catch (\Exception $e) {
} catch (\Throwable $e) {
// Check if this is a lock acquisition failure
if (str_contains($e->getMessage(), 'Failed to acquire database lock')) {
throw new CodeImportException("Import failed: " . $e->getMessage());
Expand Down
4 changes: 2 additions & 2 deletions src/Service/CodeImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function isVocabularyLoaded(string $codeType): bool
);

return $result && $result['count'] > 0;
} catch (\Exception) {
} catch (\Throwable) {
// If query fails, assume not loaded to be safe
return false;
}
Expand Down Expand Up @@ -412,7 +412,7 @@ private function releaseLock(): void

try {
sqlQuery("SELECT RELEASE_LOCK(?)", [$this->currentLockName]);
} catch (\Exception $e) {
} catch (\Throwable $e) {
// Log error but don't throw exception during cleanup
error_log("Warning: Failed to release database lock '{$this->currentLockName}': " . $e->getMessage());
} finally {
Expand Down
2 changes: 1 addition & 1 deletion src/Service/OpenEMRConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function initialize(string $openemrPath, string $site = 'default'): void
} else {
throw new OpenEMRConnectorException("OpenEMR database functions not available");
}
} catch (\Exception $e) {
} catch (\Throwable $e) {
throw new OpenEMRConnectorException("OpenEMR database connection test failed: " . $e->getMessage());
}

Expand Down
4 changes: 2 additions & 2 deletions tests/E2E/RealVocabularyImportE2ETest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function setUp(): void
$this->connector = new OpenEMRConnector();
try {
$this->connector->initialize(self::OPENEMR_PATH, self::SITE);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$this->markTestSkipped('OpenEMR initialization failed: ' . $e->getMessage());
}
}
Expand Down Expand Up @@ -307,7 +307,7 @@ private function getTableCount(string $tableName): int

$result = $this->connector->querySql("SELECT COUNT(*) as cnt FROM `{$tableName}`");
return (int) ($result['cnt'] ?? 0);
} catch (\Exception) {
} catch (\Throwable) {
return 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/E2E/VocabularyImportE2ETest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function setUp(): void
$this->connector = new OpenEMRConnector();
try {
$this->connector->initialize(self::OPENEMR_PATH, self::SITE);
} catch (\Exception $e) {
} catch (\Throwable $e) {
$this->markTestSkipped('OpenEMR initialization failed: ' . $e->getMessage());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/ImportCodesIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function setUp(): void
try {
$this->connector->initialize(self::OPENEMR_PATH, self::SITE);
$this->openemrAvailable = true;
} catch (\Exception $e) {
} catch (\Throwable $e) {
$this->markTestSkipped('OpenEMR initialization failed: ' . $e->getMessage());
}
}
Expand Down