fix: don't return error when event data is nil

This commit is contained in:
James Houlahan 2020-04-17 09:09:34 +02:00 committed by Jakub Cuth
parent e1ecc11f38
commit 341a6501e6
7 changed files with 15 additions and 14 deletions

View File

@ -5,12 +5,13 @@
package mocks
import (
credentials "github.com/ProtonMail/proton-bridge/internal/bridge/credentials"
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
crypto "github.com/ProtonMail/gopenpgp/crypto"
gomock "github.com/golang/mock/gomock"
io "io"
reflect "reflect"
crypto "github.com/ProtonMail/gopenpgp/crypto"
credentials "github.com/ProtonMail/proton-bridge/internal/bridge/credentials"
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
gomock "github.com/golang/mock/gomock"
)
// MockConfiger is a mock of Configer interface

View File

@ -28,9 +28,9 @@ import (
"strings"
"time"
mobileconfig "github.com/ProtonMail/go-apple-mobileconfig"
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
mobileconfig "github.com/ProtonMail/go-apple-mobileconfig"
)
func init() { //nolint[gochecknoinit]

View File

@ -36,6 +36,7 @@ import (
"sync"
"time"
"github.com/ProtonMail/go-autostart"
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/events"
"github.com/ProtonMail/proton-bridge/internal/frontend/autoconfig"
@ -44,7 +45,6 @@ import (
"github.com/ProtonMail/proton-bridge/pkg/config"
"github.com/ProtonMail/proton-bridge/pkg/ports"
"github.com/ProtonMail/proton-bridge/pkg/useragent"
"github.com/ProtonMail/go-autostart"
//"github.com/ProtonMail/proton-bridge/pkg/keychain"
"github.com/ProtonMail/proton-bridge/pkg/listener"

View File

@ -405,8 +405,8 @@ func (loop *eventLoop) processMessages(eventLog *logrus.Entry, messages []*pmapi
msgLog.Debug("Processing EventCreate for message")
if message.Created == nil {
msgLog.Error("Got EventCreate with nil message")
return errors.Wrap(err, "no message to put into DB")
msgLog.Warn("Got EventCreate with nil message")
continue
}
if err = loop.store.createOrUpdateMessageEvent(message.Created); err != nil {
@ -417,8 +417,8 @@ func (loop *eventLoop) processMessages(eventLog *logrus.Entry, messages []*pmapi
msgLog.Debug("Processing EventUpdate(Flags) for message")
if message.Updated == nil {
msgLog.Errorf("Got EventUpdate(Flags) with nil message")
return errors.Wrap(err, "missing update information")
msgLog.Warn("Got EventUpdate(Flags) with nil message")
continue
}
var msg *pmapi.Message

View File

@ -5,8 +5,9 @@
package mocks
import (
gomock "github.com/golang/mock/gomock"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockPanicHandler is a mock of PanicHandler interface

View File

@ -5,9 +5,10 @@
package mocks
import (
gomock "github.com/golang/mock/gomock"
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
)
// MockListener is a mock of Listener interface

View File

@ -17,8 +17,6 @@
package pmapi
import "net/http"
// Common response codes.
const (
CodeOk = 1000