mirror of
https://github.com/usememos/memos.git
synced 2024-11-14 10:44:50 +08:00
20 lines
224 B
Go
20 lines
224 B
Go
|
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
|
||
|
}
|
||
|
}
|