• Michael Bryant's avatar
    Improve error handling: no ignored errors · 3a749f9a
    Michael Bryant authored
    The point of the "OrDefault" functions was originally to provide a
    default value for if the configuration option was not present. The
    original implementation returned the default if any errors occurred,
    which could cause improper configurations to go unnoticed.
    Now the default is only used if the interface is nil, otherwise the
    error is returned.
    Errors now contain the improper value, to give more context as to where
    the error occurred.
    Errors were originally based on constant strings so the error could be
    checked against the string to see if that's the error it was. With calls
    to fmt.Errorf, this no longer works, so there are new helper functions
    to determine if an error is of a specfic type. These functions assume
    only errors from interparser are given to them, so errors from elsewhere
    may cause false positives.
Last commit
Last update
errors.go Loading commit data...