package
Version:
v0.3.7
Opens a new window with list of versions in this module.
Published: Jul 2, 2018
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Err - string errors
Read Dave Cheney article about constant errors.
As constants of the Error type are not variables, they are immutable.
Usage:
import(
."github.com/ninedraft/boxofstuff/err"
)
const (
ErrInvalidConfigFile Err = "invalid config file"
ErrInvalidFilePath Err = "invalid file path"
ErrIvalidEMail Err = "invalid e-mail"
)
func loadConfig(filePath string) error {
// ...
if invalidConfig(configText) {
return ErrInvalidConfigFile
}
}
func main() {
switch loadConfig("./config.toml") {
case nil:
// yay
case ErrInvalidConnfig:
// do stuff
case ErrInvalidFilePath:
// do stuff
default:
// do stuff
}
}
Documentation
¶
Err - string err
Usage:
```
import(
. "github.com/ninedraft/boxofstuff"
)
const(
ErrInvalidConfigFile Err = "invalid config file"
)
```
func Errorf(format string, args ...interface{}) Err
Errorf - creates Err from formatted string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.