Skip to content

Commit

Permalink
Format errors lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Dec 30, 2023
1 parent 9f6c636 commit 189faa4
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 81 deletions.
20 changes: 10 additions & 10 deletions backend/bindings/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ func addFactoryGameLog(writer *zip.Writer) error {
if runtime.GOOS == "windows" {
cacheDir, err := os.UserCacheDir()
if err != nil {
return errors.Wrap(err, "Failed to get user cache dir")
return errors.Wrap(err, "failed to get user cache dir")
}
err = utils.AddFileToZip(writer, path.Join(cacheDir, "FactoryGame", "Saved", "Logs", "FactoryGame.log"), "FactoryGame.log")
if err != nil {
if !os.IsNotExist(err) {
return errors.Wrap(err, "Failed to add file to zip")
return errors.Wrap(err, "failed to add file to zip")
}
}
}
Expand Down Expand Up @@ -99,7 +99,7 @@ func addMetadata(writer *zip.Writer) error {

lockfile, err := BindingsInstance.FicsitCLI.GetSelectedInstallLockfile()
if err != nil {
return errors.Wrap(err, "Failed to get lockfile")
return errors.Wrap(err, "failed to get lockfile")
}

metadataInstalledMods := make(map[string]string)
Expand All @@ -124,43 +124,43 @@ func addMetadata(writer *zip.Writer) error {

metadataBytes, err := utils.JSONMarshal(metadata, 2)
if err != nil {
return errors.Wrap(err, "Failed to marshal metadata")
return errors.Wrap(err, "failed to marshal metadata")
}

metadataFile, err := writer.Create("metadata.json")
if err != nil {
return errors.Wrap(err, "Failed to create metadata file")
return errors.Wrap(err, "failed to create metadata file")
}

_, err = metadataFile.Write(metadataBytes)
if err != nil {
return errors.Wrap(err, "Failed to write metadata")
return errors.Wrap(err, "failed to write metadata")
}
return nil
}

func (d *DebugInfo) generateAndSaveDebugInfo(filename string) error {
file, err := os.Create(filename)
if err != nil {
return errors.Wrap(err, "Failed to create file")
return errors.Wrap(err, "failed to create file")
}
defer file.Close()
writer := zip.NewWriter(file)
defer writer.Close()

err = addFactoryGameLog(writer)
if err != nil {
return errors.Wrap(err, "Failed to add FactoryGame.log to debuginfo zip")
return errors.Wrap(err, "failed to add FactoryGame.log to debuginfo zip")
}

err = addMetadata(writer)
if err != nil {
return errors.Wrap(err, "Failed to add metadata to debuginfo zip")
return errors.Wrap(err, "failed to add metadata to debuginfo zip")
}

err = utils.AddFileToZip(writer, viper.GetString("log-file"), "SatisfactoryModManager.log")
if err != nil {
return errors.Wrap(err, "Failed to add SatisfactoryModManager.log to debuginfo zip")
return errors.Wrap(err, "failed to add SatisfactoryModManager.log to debuginfo zip")
}

return nil
Expand Down
10 changes: 5 additions & 5 deletions backend/bindings/ficsitcli/installs.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ func (f *FicsitCLI) SelectInstall(path string) error {
}
installation := f.GetInstallation(path)
if installation == nil {
l.Error("Failed to find installation")
return errors.New("Installation \"" + path + "\" not found")
l.Error("failed to find installation")
return errors.Errorf("installation %s not found", path)
}
f.selectedInstallation = installation

Expand All @@ -178,7 +178,7 @@ func (f *FicsitCLI) SelectInstall(path string) error {
installErr := f.validateInstall(f.selectedInstallation, "__select_install__")

if installErr != nil {
l.Error("Failed to validate install", slog.Any("error", installErr))
l.Error("failed to validate install", slog.Any("error", installErr))
return errors.Wrap(installErr, "Failed to validate install")
}
return nil
Expand All @@ -194,7 +194,7 @@ func (f *FicsitCLI) GetSelectedInstall() *common.Installation {
func (f *FicsitCLI) SetModsEnabled(enabled bool) error {
if f.selectedInstallation == nil {
slog.Error("no installation selected")
return errors.New("No installation selected")
return errors.New("no installation selected")
}
l := slog.With(slog.String("task", "setModsEnabled"), slog.Bool("enabled", enabled), utils.SlogPath("install", f.selectedInstallation.Info.Path))

Expand Down Expand Up @@ -224,7 +224,7 @@ func (f *FicsitCLI) SetModsEnabled(enabled bool) error {

if installErr != nil {
l.Error("failed to validate install", slog.Any("error", installErr))
return errors.Wrap(installErr, "Failed to validate install")
return errors.Wrap(installErr, "failed to validate install")
}

return nil
Expand Down
34 changes: 17 additions & 17 deletions backend/bindings/ficsitcli/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (f *FicsitCLI) validateInstall(installation *InstallationInfo, progressItem

installErr := installation.Installation.Install(f.ficsitCli, installChannel)
if installErr != nil {
return errors.Wrap(installErr, "Failed to install")
return errors.Wrap(installErr, "failed to install")
}
return nil
}
Expand Down Expand Up @@ -195,19 +195,19 @@ func (f *FicsitCLI) EmitGlobals() {

func (f *FicsitCLI) InstallMod(mod string) error {
if f.progress != nil {
return errors.New("Another operation in progress")
return errors.New("another operation in progress")
}

if f.selectedInstallation == nil {
return errors.New("No installation selected")
return errors.New("no installation selected")
}

profileName := f.selectedInstallation.Installation.Profile
profile := f.GetProfile(profileName)

profileErr := profile.AddMod(mod, ">=0.0.0")
if profileErr != nil {
return errors.Wrapf(profileErr, "Failed to add mod: %s@latest", mod)
return errors.Wrapf(profileErr, "failed to add mod: %s@latest", mod)
}

f.progress = &Progress{
Expand All @@ -223,7 +223,7 @@ func (f *FicsitCLI) InstallMod(mod string) error {
installErr := f.validateInstall(f.selectedInstallation, mod)

if installErr != nil {
return errors.Wrapf(installErr, "Failed to install mod: %s@latest", mod)
return errors.Wrapf(installErr, "failed to install mod: %s@latest", mod)
}

_ = f.ficsitCli.Profiles.Save()
Expand All @@ -233,11 +233,11 @@ func (f *FicsitCLI) InstallMod(mod string) error {

func (f *FicsitCLI) InstallModVersion(mod string, version string) error {
if f.progress != nil {
return errors.New("Another operation in progress")
return errors.New("another operation in progress")
}

if f.selectedInstallation == nil {
return errors.New("No installation selected")
return errors.New("no installation selected")
}

profileName := f.selectedInstallation.Installation.Profile
Expand All @@ -261,7 +261,7 @@ func (f *FicsitCLI) InstallModVersion(mod string, version string) error {
installErr := f.validateInstall(f.selectedInstallation, mod)

if installErr != nil {
return errors.Wrapf(installErr, "Failed to install mod: %s@%s", mod, version)
return errors.Wrapf(installErr, "failed to install mod: %s@%s", mod, version)
}

_ = f.ficsitCli.Profiles.Save()
Expand All @@ -271,11 +271,11 @@ func (f *FicsitCLI) InstallModVersion(mod string, version string) error {

func (f *FicsitCLI) RemoveMod(mod string) error {
if f.progress != nil {
return errors.New("Another operation in progress")
return errors.New("another operation in progress")
}

if f.selectedInstallation == nil {
return errors.New("No installation selected")
return errors.New("no installation selected")
}

profileName := f.selectedInstallation.Installation.Profile
Expand All @@ -296,7 +296,7 @@ func (f *FicsitCLI) RemoveMod(mod string) error {
installErr := f.validateInstall(f.selectedInstallation, mod)

if installErr != nil {
return errors.Wrapf(installErr, "Failed to remove mod: %s", mod)
return errors.Wrapf(installErr, "failed to remove mod: %s", mod)
}

_ = f.ficsitCli.Profiles.Save()
Expand All @@ -306,11 +306,11 @@ func (f *FicsitCLI) RemoveMod(mod string) error {

func (f *FicsitCLI) EnableMod(mod string) error {
if f.progress != nil {
return errors.New("Another operation in progress")
return errors.New("another operation in progress")
}

if f.selectedInstallation == nil {
return errors.New("No installation selected")
return errors.New("no installation selected")
}

profileName := f.selectedInstallation.Installation.Profile
Expand All @@ -331,7 +331,7 @@ func (f *FicsitCLI) EnableMod(mod string) error {
installErr := f.validateInstall(f.selectedInstallation, mod)

if installErr != nil {
return errors.Wrapf(installErr, "Failed to enable mod: %s", mod)
return errors.Wrapf(installErr, "failed to enable mod: %s", mod)
}

_ = f.ficsitCli.Profiles.Save()
Expand All @@ -341,11 +341,11 @@ func (f *FicsitCLI) EnableMod(mod string) error {

func (f *FicsitCLI) DisableMod(mod string) error {
if f.progress != nil {
return errors.New("Another operation in progress")
return errors.New("another operation in progress")
}

if f.selectedInstallation == nil {
return errors.New("No installation selected")
return errors.New("no installation selected")
}

profileName := f.selectedInstallation.Installation.Profile
Expand All @@ -366,7 +366,7 @@ func (f *FicsitCLI) DisableMod(mod string) error {
installErr := f.validateInstall(f.selectedInstallation, mod)

if installErr != nil {
return errors.Wrapf(installErr, "Failed to disable mod: %s", mod)
return errors.Wrapf(installErr, "failed to disable mod: %s", mod)
}

_ = f.ficsitCli.Profiles.Save()
Expand Down
Loading

0 comments on commit 189faa4

Please sign in to comment.