Skip to content

Commit 9e4de8b

Browse files
committed
Apply suggestion after review
1 parent cd6747e commit 9e4de8b

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

websocket_managed_conn.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,26 @@ import (
1919
// UnmappedError represents error occurred when there is no mapping between given event name
2020
// and corresponding Go struct.
2121
type UnmappedError struct {
22-
eventType string
23-
rawEvent json.RawMessage
24-
ctxMsg string
22+
// EventType returns event type name.
23+
EventType string
24+
// RawEvent returns raw event body.
25+
RawEvent json.RawMessage
26+
27+
ctxMsg string
2528
}
2629

2730
// NewUnmappedError returns new UnmappedError instance.
2831
func NewUnmappedError(ctxMsg, eventType string, raw json.RawMessage) *UnmappedError {
2932
return &UnmappedError{
3033
ctxMsg: ctxMsg,
31-
eventType: eventType,
32-
rawEvent: raw,
34+
EventType: eventType,
35+
RawEvent: raw,
3336
}
3437
}
3538

3639
// Error returns human-readable error message.
3740
func (u UnmappedError) Error() string {
38-
return fmt.Sprintf("%s: Received unmapped event %q", u.ctxMsg, u.eventType)
39-
}
40-
41-
// EventType returns event type name.
42-
func (u UnmappedError) EventType() string {
43-
return u.eventType
44-
}
45-
46-
// RawEvent returns raw event body.
47-
func (u UnmappedError) RawEvent() json.RawMessage {
48-
return u.rawEvent
41+
return fmt.Sprintf("%s: Received unmapped event %q", u.ctxMsg, u.EventType)
4942
}
5043

5144
// ManageConnection can be called on a Slack RTM instance returned by the

websocket_managed_conn_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func TestRTMUnmappedError(t *testing.T) {
355355
// Verify that we got the expected error with details
356356
unmappedErr, ok := gotUnmarshallingError.ErrorObj.(*slack.UnmappedError)
357357
require.True(t, ok)
358-
assert.Equal(t, unmappedEventName, unmappedErr.EventType())
358+
assert.Equal(t, unmappedEventName, unmappedErr.EventType)
359359
}
360360

361361
func fixSlackMessage(t *testing.T, eType string) string {

0 commit comments

Comments
 (0)