diff options
-rw-r--r-- | internal/builder/builder.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/builder/builder.go b/internal/builder/builder.go index 88e3f02..90e957c 100644 --- a/internal/builder/builder.go +++ b/internal/builder/builder.go @@ -3,7 +3,6 @@ package builder import ( "fmt" "io" - "log" "log/slog" "net/url" "os" @@ -175,21 +174,21 @@ func build(outDir string, config config.Config) error { func BuildSite(ioConfig IOConfig) error { config, err := config.GetConfig() if err != nil { - log.Panic(errors.Errorf("could not get config: %v", err)) + return errors.WithMessage(err, "could not get config") } config.InjectLiveReload = ioConfig.Development if ioConfig.BaseURL.URL != nil { config.BaseURL.URL, err = url.Parse(ioConfig.BaseURL.String()) if err != nil { - log.Panic(errors.Errorf("highly unlikely: %v", err)) + return errors.WithMessage(err, "could not re-parse base URL") } } if ioConfig.Development && ioConfig.Destination != "website" { err = os.RemoveAll(ioConfig.Destination) if err != nil { - log.Panic(errors.Errorf("could not remove destination directory: %v", err)) + return errors.WithMessage(err, "could not remove destination directory") } } |