nuclei/pkg/templates/parser_error.go
Sandeep Singh b4644af80a
Lint + test fixes after utils dep update (#6393)
* fix: remove undefined errorutil.ShowStackTrace

* feat: add make lint support and integrate with test

* refactor: migrate errorutil to errkit across codebase

- Replace deprecated errorutil with modern errkit
- Convert error declarations from var to func for better compatibility
- Fix all SA1019 deprecation warnings
- Maintain error chain support and stack traces

* fix: improve DNS test reliability using Google DNS

- Configure test to use Google DNS (8.8.8.8) for stability
- Fix nil pointer issue in DNS client initialization
- Keep production defaults unchanged

* fixing logic

* removing unwanted branches in makefile

---------

Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
2025-08-20 05:28:23 +05:30

29 lines
880 B
Go

package templates
import (
"fmt"
"github.com/projectdiscovery/utils/errkit"
)
// Helper functions for template errors with formatting
func ErrMandatoryFieldMissingFmt(field string) error {
return errkit.New(fmt.Sprintf("mandatory '%s' field is missing", field)).Build()
}
func ErrInvalidField(field, format string) error {
return errkit.New(fmt.Sprintf("invalid field format for '%s' (allowed format is %s)", field, format)).Build()
}
func ErrWarningFieldMissing(field string) error {
return errkit.New(fmt.Sprintf("field '%s' is missing", field)).Build()
}
func ErrCouldNotLoadTemplate(path, reason string) error {
return errkit.New(fmt.Sprintf("Could not load template %s: %s", path, reason)).Build()
}
func ErrLoadedWithWarnings(path, warning string) error {
return errkit.New(fmt.Sprintf("Loaded template %s: with syntax warning : %s", path, warning)).Build()
}