Home

tmpl @c348255c37c2cb20b13fe00fdcd4fc6a968feec2 - refs - log -
-
https://git.jolheiser.com/tmpl.git
Template automation
tmpl / registry / error.go
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package registry

import "fmt"

type ErrTemplateExists struct {
	Name string
}

func (e ErrTemplateExists) Error() string {
	return fmt.Sprintf("template %s already exists", e.Name)
}

func IsErrTemplateExists(err error) bool {
	_, ok := err.(ErrTemplateExists)
	return ok
}

type ErrTemplateNotFound struct {
	Name string
}

func (e ErrTemplateNotFound) Error() string {
	return fmt.Sprintf("template not found for %s", e.Name)
}

type ErrSourceNotFound struct {
	Name string
}

func (e ErrSourceNotFound) Error() string {
	return fmt.Sprintf("Source not found for %s", e.Name)
}

func IsErrSourceNotFound(err error) bool {
	_, ok := err.(ErrSourceNotFound)
	return ok
}