Allow NewHook() to return an error (for future changes).
This commit is contained in:
Родитель
fac370737d
Коммит
5b1d662d5a
|
@ -71,7 +71,11 @@ func generateResponseFile(templFP string, data *gengokit.Data, prevFile io.Reade
|
|||
}
|
||||
|
||||
case handlers.HookPath:
|
||||
hook := handlers.NewHook(prevFile)
|
||||
hook, err := handlers.NewHook(prevFile)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot parse previous hooks: %s", templFP)
|
||||
}
|
||||
|
||||
genCode, err = hook.Render(templFP, data)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot render template: %s", templFP)
|
||||
|
|
|
@ -11,10 +11,10 @@ import (
|
|||
const HookPath = "handlers/hooks.gotemplate"
|
||||
|
||||
// NewHook returns a new HookRender
|
||||
func NewHook(prev io.Reader) gengokit.Renderable {
|
||||
func NewHook(prev io.Reader) (gengokit.Renderable, error) {
|
||||
return &HookRender{
|
||||
prev: prev,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
type HookRender struct {
|
||||
|
|
Загрузка…
Ссылка в новой задаче