Skip to content

Commit

Permalink
Rename field error_message to message
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Sep 27, 2024
1 parent 7ced565 commit 44c96d8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions handlers/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ type AnalyticsLogEvent struct {
WindowWidthPX *int `json:"window_width_px"`

// Error event
ErrorMessage *string `json:"error_message"`
Category *string `json:"category"`
Message *string `json:"message"`
Category *string `json:"category"`
}

type AnalyticsGeo struct {
Expand Down Expand Up @@ -275,16 +275,16 @@ func (c *AnalyticsHandlersCollection) toAnalyticsData(log *AnalyticsLog, geo Ana
WindowHeightPX: e.WindowHeightPX,
WindowWidthPX: e.WindowWidthPX,

ErrorMessage: e.ErrorMessage,
Category: e.Category,
Message: e.Message,
Category: e.Category,
},
})
}
return res
}

func isSupportedEvent(eventType string) bool {
if eventType == "heartbeat" || eventType == "error" || eventType == "warning" {
if eventType == "heartbeat" || eventType == "error" {
return true
}
return false
Expand Down
4 changes: 2 additions & 2 deletions handlers/analytics/log_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ type LogDataEvent struct {
WindowWidthPX *int `json:"window_width_px,omitempty"`

// Error event
ErrorMessage *string `json:"error_message,omitempty"`
Category *string `json:"category,omitempty"`
Message *string `json:"message,omitempty"`
Category *string `json:"category,omitempty"`
}

type LogData struct {
Expand Down
8 changes: 4 additions & 4 deletions handlers/analytics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestHandleLog(t *testing.T) {
"id": "abcde12345",
"type": "error",
"timestamp": 1234567895,
"error_message": "error message",
"message": "error message",
"category": "offline"
}
]
Expand Down Expand Up @@ -161,9 +161,9 @@ func TestHandleLog(t *testing.T) {
EventType: "error",
EventTimestamp: 1234567895,
EventData: analytics.LogDataEvent{
ID: strPtr("abcde12345"),
ErrorMessage: strPtr("error message"),
Category: strPtr("offline"),
ID: strPtr("abcde12345"),
Message: strPtr("error message"),
Category: strPtr("offline"),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion handlers/schemas/AnalyticsLog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ properties:
type: "integer"
autoplay_status:
type: "string"
error_message:
message:
type: "string"
required:
- type
Expand Down

0 comments on commit 44c96d8

Please sign in to comment.