fix: don't return error when event data is nil
This commit is contained in:
parent
e1ecc11f38
commit
341a6501e6
|
@ -5,12 +5,13 @@
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
import (
|
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"
|
io "io"
|
||||||
reflect "reflect"
|
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
|
// MockConfiger is a mock of Configer interface
|
||||||
|
|
|
@ -28,9 +28,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
mobileconfig "github.com/ProtonMail/go-apple-mobileconfig"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
||||||
mobileconfig "github.com/ProtonMail/go-apple-mobileconfig"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() { //nolint[gochecknoinit]
|
func init() { //nolint[gochecknoinit]
|
||||||
|
|
|
@ -36,6 +36,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ProtonMail/go-autostart"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
"github.com/ProtonMail/proton-bridge/internal/events"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/autoconfig"
|
"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/config"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/ports"
|
"github.com/ProtonMail/proton-bridge/pkg/ports"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/useragent"
|
"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/keychain"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
||||||
|
|
|
@ -405,8 +405,8 @@ func (loop *eventLoop) processMessages(eventLog *logrus.Entry, messages []*pmapi
|
||||||
msgLog.Debug("Processing EventCreate for message")
|
msgLog.Debug("Processing EventCreate for message")
|
||||||
|
|
||||||
if message.Created == nil {
|
if message.Created == nil {
|
||||||
msgLog.Error("Got EventCreate with nil message")
|
msgLog.Warn("Got EventCreate with nil message")
|
||||||
return errors.Wrap(err, "no message to put into DB")
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = loop.store.createOrUpdateMessageEvent(message.Created); err != nil {
|
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")
|
msgLog.Debug("Processing EventUpdate(Flags) for message")
|
||||||
|
|
||||||
if message.Updated == nil {
|
if message.Updated == nil {
|
||||||
msgLog.Errorf("Got EventUpdate(Flags) with nil message")
|
msgLog.Warn("Got EventUpdate(Flags) with nil message")
|
||||||
return errors.Wrap(err, "missing update information")
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg *pmapi.Message
|
var msg *pmapi.Message
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockPanicHandler is a mock of PanicHandler interface
|
// MockPanicHandler is a mock of PanicHandler interface
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
time "time"
|
time "time"
|
||||||
|
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockListener is a mock of Listener interface
|
// MockListener is a mock of Listener interface
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
package pmapi
|
package pmapi
|
||||||
|
|
||||||
import "net/http"
|
|
||||||
|
|
||||||
// Common response codes.
|
// Common response codes.
|
||||||
const (
|
const (
|
||||||
CodeOk = 1000
|
CodeOk = 1000
|
||||||
|
|
Loading…
Reference in New Issue