Fix ebook scanner error handling for database queries
- Remove string-based error checking for no rows - Use proper pgx.ErrNoRows comparison only - Improve error handling consistency in processEbookFile function
This commit is contained in:
@@ -226,7 +226,7 @@ func (s *EbookScanner) processEbookFile(ctx context.Context, path string) error
|
|||||||
}
|
}
|
||||||
fmt.Printf("Ebook already exists with same size, skipping: %s\n", path)
|
fmt.Printf("Ebook already exists with same size, skipping: %s\n", path)
|
||||||
return nil // Skip if already exists and size matches
|
return nil // Skip if already exists and size matches
|
||||||
} else if err != pgx.ErrNoRows && !strings.Contains(err.Error(), "no rows") {
|
} else if err != pgx.ErrNoRows {
|
||||||
fmt.Printf("Database error checking ebook existence: %v\n", err)
|
fmt.Printf("Database error checking ebook existence: %v\n", err)
|
||||||
// Some other error occurred
|
// Some other error occurred
|
||||||
return fmt.Errorf("failed to check if ebook exists: %v", err)
|
return fmt.Errorf("failed to check if ebook exists: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user