Basic stuff, loadOne

This commit is contained in:
Nikita Tokarchuk
2018-12-09 02:03:12 +01:00
parent 2e9637c110
commit 913dcb2f1e
11 changed files with 461 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package errors
import "fmt"
// InternalError error
type InternalError string
// Error message
func (ie InternalError) Error() string {
return fmt.Sprintf("internal error, %s", string(ie))
}
// InternalErrorf function creates an instance of InternalError
func InternalErrorf(format string, params ...interface{}) error {
return InternalError(fmt.Sprintf(format, params...))
}
+16
View File
@@ -0,0 +1,16 @@
package errors
import "fmt"
// NotFound error
type NotFound string
// Error message
func (nf NotFound) Error() string {
return fmt.Sprintf("can not find, %s", string(nf))
}
// NotFoundErrorf function creates an instance of BadRequestError
func NotFoundErrorf(format string, params ...interface{}) error {
return NotFound(fmt.Sprintf(format, params...))
}