modified logic in ocr

This commit is contained in:
dhanabalan
2025-10-18 12:02:51 +05:30
parent d05876cccd
commit 4f3db02780

View File

@@ -52,9 +52,30 @@ use thiagoalessio\TesseractOCR\TesseractOCR;
->run(); ->run();
return response()->json(['success' => true, 'text' => $text]); return response()->json(['success' => true, 'text' => $text]);
} catch (\Exception $e) {
return response()->json(['success' => false, 'error' => $e->getMessage()]);
} }
//catch (\Exception $e) {
// return response()->json(['success' => false, 'error' => $e->getMessage()]);
// }
catch (\Exception $e) {
// Log the full exception class and message
\Log::error('Tesseract OCR failed', [
'exception_class' => get_class($e),
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => $e->getTraceAsString(),
]);
// Return detailed error for debugging
return response()->json([
'success' => false,
'error' => $e->getMessage(),
'exception_class' => get_class($e),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => $e->getTraceAsString(),
]);
}
}); });