memos/store/error.go

20 lines
224 B
Go
Raw Normal View History

2022-05-22 00:59:22 +08:00
package store
import (
"database/sql"
"errors"
)
func FormatError(err error) error {
if err == nil {
return nil
}
switch err {
case sql.ErrNoRows:
return errors.New("data not found")
default:
return err
}
}