Skip to content

Commit

Permalink
feat(panic): removed the last ones :)
Browse files Browse the repository at this point in the history
  • Loading branch information
StanGirard committed Apr 9, 2023
1 parent 71850f2 commit a675028
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion internal/report/readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"github.com/padok-team/yatas/internal/helpers"
"github.com/padok-team/yatas/plugins/logger"
)

func WriteReadme(readmeFile string, resultFile string) error {
Expand All @@ -31,7 +32,8 @@ func GenerateReadme(filename string) string {
report, err := parseReportYaml(filename)
readme := ""
if err != nil {
panic(err)
logger.Error(err.Error())
return readme
}
splitFirst := ""
splitSecond := ""
Expand Down
10 changes: 7 additions & 3 deletions internal/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/fatih/color"
"github.com/padok-team/yatas/plugins/commons"
"github.com/padok-team/yatas/plugins/logger"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -176,7 +177,8 @@ func ReadPreviousResults() []commons.Tests {
var checks []commons.Tests
err = yaml.Unmarshal(d, &checks)
if err != nil {
panic(err)
logger.Error(err.Error())
return nil
}
return checks
}
Expand All @@ -196,13 +198,15 @@ func WriteChecksToFile(checks []commons.Tests, c *commons.Config) {
}
d, err := yaml.Marshal(checks)
if err != nil {
panic(err)
logger.Error(err.Error())
return
}

// Write to results.yaml
err = ioutil.WriteFile("results.yaml", d, 0644)
if err != nil {
panic(err)
logger.Error(err.Error())
return
}

}
Expand Down

0 comments on commit a675028

Please # to comment.