Browse Source

return null first

visuddhinanda 5 days ago
parent
commit
208d33f2a5
1 changed files with 3 additions and 4 deletions
  1. 3 4
      api-v13/app/Services/PaliTextService.php

+ 3 - 4
api-v13/app/Services/PaliTextService.php

@@ -34,12 +34,11 @@ class PaliTextService
             ->where('paragraph', '<=', $para)
             ->where('paragraph', '<=', $para)
             ->where('level', 1)
             ->where('level', 1)
             ->orderBy('paragraph', 'asc')->first();
             ->orderBy('paragraph', 'asc')->first();
-        if ($paragraph) {
-            return $paragraph;
-        } else {
-            Log::error('not found book ', ['book' => $book, 'para' => $para]);
+        if (!$paragraph) {
+            Log::warning('not found book ', ['book' => $book, 'para' => $para]);
             return null;
             return null;
         }
         }
+        return $paragraph;
     }
     }
     public function getParaCategoryTags(int $book, int $para): array
     public function getParaCategoryTags(int $book, int $para): array
     {
     {