modified logic in ocr
This commit is contained in:
@@ -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(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user