feat: add error warp

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ
2020-06-25 17:37:18 +08:00
parent 86d8e7e16e
commit 31419dc003
8 changed files with 159 additions and 87 deletions
+19 -1
View File
@@ -1,6 +1,7 @@
package utils
import (
"errors"
"fmt"
"hack-browser-data/log"
"io/ioutil"
@@ -11,6 +12,23 @@ import (
"time"
)
var (
passwordIsEmpty = errors.New("decrypt fail, password is empty")
)
type DecryptError struct {
err error
msg string
}
func (e *DecryptError) Error() string {
return fmt.Sprintf("%s: %s", e.msg, e.err)
}
func (e *DecryptError) Unwrap() error {
return e.err
}
const (
LoginData = "Login Data"
History = "History"
@@ -49,7 +67,7 @@ func IntToBool(a int) bool {
func TimeEpochFormat(epoch int64) time.Time {
maxTime := int64(99633311740000000)
if epoch > maxTime{
if epoch > maxTime {
epoch = maxTime
}
t := time.Date(1601, 1, 1, 0, 0, 0, 0, time.UTC)