Add throw exception to get mime info if there is no mime type found

Instead of returning empty
This commit is contained in:
Clemens Schwaighofer
2026-05-11 13:38:17 +09:00
parent 6b1261b157
commit 85f7e114b0
3 changed files with 15 additions and 4 deletions
+5
View File
@@ -38,6 +38,11 @@ print "GETFILENAMEENDING: $file: " . File::getFilenameEnding($file) . "<br>";
$file = getcwd() . DIRECTORY_SEPARATOR . 'class_test.file.php';
print "GETLINESFROMFILE: $file: " . File::getLinesFromFile($file) . "<br>";
print "MIMEINFO: $file: " . File::getMimeType($file) . "<br>";
try {
print "MIMEINFO: $file: " . File::getMimeType("does_not_exists.txt") . "<br>";
} catch (\Exception $e) {
print "Error: " . get_class($e) . ": " . $e->getMessage() . "<br>";
}
print "</body></html>";