Skip to content

Handling error - log.Fatalf #712

@rychrr

Description

@rychrr

Error Handling

Might want to use log.Fatalf judiciously.
Terminating the program on every error might not always be the best approach. Consider whether a non-critical error should instead log a warning or skip to the next contract.
Instead of directly terminating, aggregate errors and report them all at the end (if applicable) , imo..

Maybe create a function ;

func checkError(msg string, err error) { if err != nil { log.Printf("ERROR: %s: %v", msg, err) return } }

Then replace repetitive error handling with:

checkError(fmt.Sprintf("reading artifact %s", name), err)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions