forked from Silverfish/proton-bridge
Merge branch 'release/v1.2.7' into devel
This commit is contained in:
5
Makefile
5
Makefile
@ -2,7 +2,7 @@ export GO111MODULE=on
|
|||||||
GOOS:=$(shell go env GOOS)
|
GOOS:=$(shell go env GOOS)
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
.PHONY: build check-has-go
|
.PHONY: build build-nogui check-has-go
|
||||||
|
|
||||||
VERSION?=1.2.7-git
|
VERSION?=1.2.7-git
|
||||||
REVISION:=$(shell git rev-parse --short=10 HEAD)
|
REVISION:=$(shell git rev-parse --short=10 HEAD)
|
||||||
@ -36,6 +36,9 @@ TGZ_TARGET:=bridge_${GOOS}_${REVISION}.tgz
|
|||||||
|
|
||||||
build: ${TGZ_TARGET}
|
build: ${TGZ_TARGET}
|
||||||
|
|
||||||
|
build-nogui:
|
||||||
|
go build ${BUILD_FLAGS_NOGUI} -o Desktop-Bridge cmd/Desktop-Bridge/main.go
|
||||||
|
|
||||||
${TGZ_TARGET}: ${DEPLOY_DIR}/${GOOS}
|
${TGZ_TARGET}: ${DEPLOY_DIR}/${GOOS}
|
||||||
rm -f $@
|
rm -f $@
|
||||||
cd ${DEPLOY_DIR} && tar czf ../../../$@ ${GOOS}
|
cd ${DEPLOY_DIR} && tar czf ../../../$@ ${GOOS}
|
||||||
|
|||||||
@ -38,8 +38,8 @@ const Capability = "UIDPLUS"
|
|||||||
const (
|
const (
|
||||||
copyuid = "COPYUID"
|
copyuid = "COPYUID"
|
||||||
appenduid = "APPENDUID"
|
appenduid = "APPENDUID"
|
||||||
copySuccess = "COPY successful"
|
copySuccess = "COPY completed"
|
||||||
appendSucess = "APPEND successful"
|
appendSucess = "APPEND completed"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logrus.WithField("pkg", "imap/uidplus") //nolint[gochecknoglobals]
|
var log = logrus.WithField("pkg", "imap/uidplus") //nolint[gochecknoglobals]
|
||||||
|
|||||||
@ -437,7 +437,7 @@ func (loop *eventLoop) processMessages(eventLog *logrus.Entry, messages []*pmapi
|
|||||||
msgLog.WithError(err).Warning("Message was not present in DB. Trying fetch...")
|
msgLog.WithError(err).Warning("Message was not present in DB. Trying fetch...")
|
||||||
|
|
||||||
if msg, err = loop.client().GetMessage(message.ID); err != nil {
|
if msg, err = loop.client().GetMessage(message.ID); err != nil {
|
||||||
if err == pmapi.ErrNoSuchAPIID {
|
if _, ok := err.(*pmapi.ErrUnprocessableEntity); ok {
|
||||||
msgLog.WithError(err).Warn("Skipping message update because message exists neither in local DB nor on API")
|
msgLog.WithError(err).Warn("Skipping message update because message exists neither in local DB nor on API")
|
||||||
err = nil
|
err = nil
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -56,10 +56,16 @@ var (
|
|||||||
ErrInvalidToken = errors.New("refresh token invalid")
|
ErrInvalidToken = errors.New("refresh token invalid")
|
||||||
ErrAPINotReachable = errors.New("cannot reach the server")
|
ErrAPINotReachable = errors.New("cannot reach the server")
|
||||||
ErrUpgradeApplication = errors.New("application upgrade required")
|
ErrUpgradeApplication = errors.New("application upgrade required")
|
||||||
|
|
||||||
ErrNoSuchAPIID = errors.New("no such API ID")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type ErrUnprocessableEntity struct {
|
||||||
|
error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (err *ErrUnprocessableEntity) Error() string {
|
||||||
|
return err.error.Error()
|
||||||
|
}
|
||||||
|
|
||||||
type ErrUnauthorized struct {
|
type ErrUnauthorized struct {
|
||||||
error
|
error
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,11 @@
|
|||||||
|
|
||||||
package pmapi
|
package pmapi
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
)
|
||||||
|
|
||||||
// Common response codes.
|
// Common response codes.
|
||||||
const (
|
const (
|
||||||
@ -38,7 +42,7 @@ type Res struct {
|
|||||||
// Err returns error if the response is an error. Otherwise, returns nil.
|
// Err returns error if the response is an error. Otherwise, returns nil.
|
||||||
func (res Res) Err() error {
|
func (res Res) Err() error {
|
||||||
if res.StatusCode == http.StatusUnprocessableEntity {
|
if res.StatusCode == http.StatusUnprocessableEntity {
|
||||||
return ErrNoSuchAPIID
|
return &ErrUnprocessableEntity{errors.New(res.Error)}
|
||||||
}
|
}
|
||||||
|
|
||||||
if res.ResError == nil {
|
if res.ResError == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user