diff --git a/Makefile b/Makefile index 7bf4d29c..765e0ada 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/internal/imap/uidplus/extension.go b/internal/imap/uidplus/extension.go index ff86a70d..5eee2123 100644 --- a/internal/imap/uidplus/extension.go +++ b/internal/imap/uidplus/extension.go @@ -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] diff --git a/internal/store/event_loop.go b/internal/store/event_loop.go index e781294d..cfcd55c8 100644 --- a/internal/store/event_loop.go +++ b/internal/store/event_loop.go @@ -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 diff --git a/pkg/pmapi/client.go b/pkg/pmapi/client.go index e371d03c..bbd443bd 100644 --- a/pkg/pmapi/client.go +++ b/pkg/pmapi/client.go @@ -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 } diff --git a/pkg/pmapi/res.go b/pkg/pmapi/res.go index 07a5cada..dc388e4a 100644 --- a/pkg/pmapi/res.go +++ b/pkg/pmapi/res.go @@ -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 {