Add logging across app and centralized error handling

This commit is contained in:
Andrey Chervyakov 2021-03-15 19:03:30 +06:00
parent 3bbeab1199
commit 4c3f095109
10 changed files with 115 additions and 62 deletions

25
errors/errors.go Normal file
View file

@ -0,0 +1,25 @@
package errors
type NotFoundError struct {
Message string
}
func (err NotFoundError) Error() string {
return err.Message
}
type UnknownError struct {
Err error
}
func (err UnknownError) Error() string {
return err.Err.Error()
}
type AlreadyExistsError struct {
Message string
}
func (err AlreadyExistsError) Error() string {
return err.Message
}