mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Switch to Go 1.13 error wrapping (#604)
* Replaced errors.Wrap with fmt.Errorf (#589) * Find: errors\.Wrap\(([^,]+),\s+(["`][^"`]*)(["`])\) Replace: fmt.Errorf($2: %w$3, $1) * Replaced errors.Wrapf with fmt.Errorf (#589) * Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])\) Replace: fmt.Errorf($2: %w$3, $1) * Find: errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])(,[^)]+)\) * Replace: fmt.Errorf($2: %w$3$4, $1) * Replaced errors.Errorf with fmt.Errorf (#589) * Find: errors\.Errorf Replace: fmt.Errorf * Cleaned up remaining imports * Cleanup * Regenerate provider support matrix This was broken by #533 ... and it's now the third time this has been missed.
This commit is contained in:
committed by
Tom Limoncelli
parent
cae35a2c8f
commit
825ba2d081
@ -5,11 +5,11 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v2/models"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/js"
|
||||
"github.com/StackExchange/dnscontrol/v2/pkg/normalize"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var _ = cmd(catDebug, func() *cli.Command {
|
||||
@ -72,7 +72,7 @@ func PrintIR(args PrintIRArgs) error {
|
||||
if !args.Raw {
|
||||
errs := normalize.NormalizeAndValidateConfig(cfg)
|
||||
if PrintValidationErrors(errs) {
|
||||
return errors.Errorf("Exiting due to validation errors")
|
||||
return fmt.Errorf("Exiting due to validation errors")
|
||||
}
|
||||
}
|
||||
return PrintJSON(args.PrintJSONArgs, cfg)
|
||||
@ -98,12 +98,12 @@ func PrintValidationErrors(errs []error) (fatal bool) {
|
||||
// ExecuteDSL executes the dnsconfig.js contents.
|
||||
func ExecuteDSL(args ExecuteDSLArgs) (*models.DNSConfig, error) {
|
||||
if args.JSFile == "" {
|
||||
return nil, errors.Errorf("No config specified")
|
||||
return nil, fmt.Errorf("No config specified")
|
||||
}
|
||||
|
||||
dnsConfig, err := js.ExecuteJavascript(args.JSFile, args.DevMode)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("Executing javascript in %s: %s", args.JSFile, err)
|
||||
return nil, fmt.Errorf("Executing javascript in %s: %s", args.JSFile, err)
|
||||
}
|
||||
return dnsConfig, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user