Skip to content

Commit 7684c4c

Browse files
committed
refactor: replace hardcoded exception messages with translatable strings in MagicAIService
1 parent 5430a9d commit 7684c4c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/Webkul/Lead/src/Services/MagicAIService.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MagicAIService
2828
public static function extractDataFromFile($base64File)
2929
{
3030
if (self::$isExtracting) {
31-
throw new Exception('admin::app.leads.file.recursive-call');
31+
throw new Exception(trans('admin::app.leads.file.recursive-call'));
3232
}
3333

3434
self::$isExtracting = true;
@@ -37,7 +37,7 @@ public static function extractDataFromFile($base64File)
3737
$text = self::extractTextFromBase64File($base64File);
3838

3939
if (empty($text)) {
40-
throw new Exception('admin::app.leads.file.failed-extract');
40+
throw new Exception(trans('admin::app.leads.file.failed-extract'));
4141
}
4242

4343
return self::processPromptWithAI($text);
@@ -57,7 +57,7 @@ private static function extractTextFromBase64File($base64File)
5757
empty($base64File)
5858
|| ! base64_decode($base64File, true)
5959
) {
60-
throw new Exception('admin::app.leads.file.invalid-base64');
60+
throw new Exception(trans('admin::app.leads.file.invalid-base64'));
6161
}
6262

6363
$tempFile = tempnam(sys_get_temp_dir(), 'file_');
@@ -88,7 +88,7 @@ private static function extractTextFromBase64File($base64File)
8888
}
8989

9090
if (empty($data)) {
91-
throw new Exception('admin::app.leads.file.data-extraction-failed');
91+
throw new Exception(trans('admin::app.leads.file.data-extraction-failed'));
9292
}
9393

9494
return $data;

0 commit comments

Comments
 (0)