Log error when failing to unmarshal messagepack
This commit is contained in:
@@ -377,6 +377,7 @@ func (a *ActivitylogService) activities(rid *provider.ResourceId) ([]RawActivity
|
|||||||
|
|
||||||
var activities []RawActivity
|
var activities []RawActivity
|
||||||
if err := msgpack.Unmarshal(records[0].Value, &activities); err != nil {
|
if err := msgpack.Unmarshal(records[0].Value, &activities); err != nil {
|
||||||
|
a.log.Debug().Err(err).Str("resourceID", resourceID).Msg("could not unmarshal messagepack, trying json")
|
||||||
if err := json.Unmarshal(records[0].Value, &activities); err != nil {
|
if err := json.Unmarshal(records[0].Value, &activities); err != nil {
|
||||||
return nil, fmt.Errorf("could not unmarshal activities: %w", err)
|
return nil, fmt.Errorf("could not unmarshal activities: %w", err)
|
||||||
}
|
}
|
||||||
@@ -463,6 +464,7 @@ func (a *ActivitylogService) storeActivity(resourceID string, activities []RawAc
|
|||||||
var existingActivities []RawActivity
|
var existingActivities []RawActivity
|
||||||
if len(records) > 0 {
|
if len(records) > 0 {
|
||||||
if err := msgpack.Unmarshal(records[0].Value, &existingActivities); err != nil {
|
if err := msgpack.Unmarshal(records[0].Value, &existingActivities); err != nil {
|
||||||
|
a.log.Debug().Err(err).Str("resourceID", resourceID).Msg("could not unmarshal messagepack, trying json")
|
||||||
if err := json.Unmarshal(records[0].Value, &existingActivities); err != nil {
|
if err := json.Unmarshal(records[0].Value, &existingActivities); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user