Merge branch 'release/v1.2.7' into devel

This commit is contained in:
Jakub
2020-04-27 15:54:02 +02:00
5 changed files with 21 additions and 8 deletions

View File

@ -2,7 +2,7 @@ export GO111MODULE=on
GOOS:=$(shell go env GOOS)
## Build
.PHONY: build check-has-go
.PHONY: build build-nogui check-has-go
VERSION?=1.2.7-git
REVISION:=$(shell git rev-parse --short=10 HEAD)
@ -36,6 +36,9 @@ TGZ_TARGET:=bridge_${GOOS}_${REVISION}.tgz
build: ${TGZ_TARGET}
build-nogui:
go build ${BUILD_FLAGS_NOGUI} -o Desktop-Bridge cmd/Desktop-Bridge/main.go
${TGZ_TARGET}: ${DEPLOY_DIR}/${GOOS}
rm -f $@
cd ${DEPLOY_DIR} && tar czf ../../../$@ ${GOOS}

View File

@ -38,8 +38,8 @@ const Capability = "UIDPLUS"
const (
copyuid = "COPYUID"
appenduid = "APPENDUID"
copySuccess = "COPY successful"
appendSucess = "APPEND successful"
copySuccess = "COPY completed"
appendSucess = "APPEND completed"
)
var log = logrus.WithField("pkg", "imap/uidplus") //nolint[gochecknoglobals]

View File

@ -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...")
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")
err = nil
continue

View File

@ -56,10 +56,16 @@ var (
ErrInvalidToken = errors.New("refresh token invalid")
ErrAPINotReachable = errors.New("cannot reach the server")
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 {
error
}

View File

@ -17,7 +17,11 @@
package pmapi
import "net/http"
import (
"net/http"
"github.com/pkg/errors"
)
// Common response codes.
const (
@ -38,7 +42,7 @@ type Res struct {
// Err returns error if the response is an error. Otherwise, returns nil.
func (res Res) Err() error {
if res.StatusCode == http.StatusUnprocessableEntity {
return ErrNoSuchAPIID
return &ErrUnprocessableEntity{errors.New(res.Error)}
}
if res.ResError == nil {