Add custom Error type
This commit is contained in:
parent
11e3a74b22
commit
5f003c48e9
@ -1,6 +1,7 @@
|
|||||||
package persistence
|
package persistence
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -8,6 +9,15 @@ import (
|
|||||||
"offline_twitter/scraper"
|
"offline_twitter/scraper"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var NotInDatabase = errors.New("Not in database")
|
||||||
|
|
||||||
|
type ErrNotInDatabase struct {
|
||||||
|
Table string
|
||||||
|
Value interface{}
|
||||||
|
}
|
||||||
|
func (err ErrNotInDatabase) Error() string {
|
||||||
|
return fmt.Sprintf("Not in database: %s %q", err.Table, err.Value)
|
||||||
|
}
|
||||||
|
|
||||||
// DUPE 1
|
// DUPE 1
|
||||||
func file_exists(path string) bool {
|
func file_exists(path string) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user