Home

tmpl @c497431a5205cddb6e151f9b6c0e11280b2a7519 - 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
38
39
40
41
42
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)
}

func IsErrTemplateNotFound(err error) bool {
	_, ok := err.(ErrTemplateNotFound)
	return ok
}

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
}