From 76762026f32c270c9dd1929f178e74643610ab98 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Thu, 5 Oct 2023 14:11:48 -0400 Subject: [PATCH] =?UTF-8?q?Continuer=20ex=C3=A9cution=20de=20serverCmd=20m?= =?UTF-8?q?=C3=AAme=20sans=20db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remplacer log.Fatal par log.Printf si serverCmd ne rejoint pas la db. Autres changements: - Clarifier messages d'erreur du *media.MediaClient de serverCmd - Seulement seed si mediaClient est valide (should always be mais bon) --- cmd/server.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index 1149cb3..aac8313 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -48,17 +48,18 @@ var serverCmd = &cobra.Command{ } mediaClient, err := media.NewMediaClientFromViper() - if err != nil { - log.Fatal(err) + switch err != nil { + case true: + log.Printf("media.NewMediaClientFromViper error: %s", err) + case false: + new_buckets, err := mediaClient.Seed() + if err != nil { + log.Printf("(*media.MediaClient).Seed error: %s", err) + } else { + log.Printf("Seeded %d buckets.\n", len(new_buckets)) + } } - new_buckets, err := mediaClient.Seed() - if err != nil { - log.Fatal(err) - } - - log.Printf("Seeded %d buckets.\n", len(new_buckets)) - RunServer() }, }