@@ -135,8 +135,7 @@ func (o *openCDCUnwrapper) UnwrapOperation(structData record.StructuredData) (re
135
135
case record.Operation :
136
136
operation = o
137
137
case string :
138
- err := operation .UnmarshalText ([]byte (o ))
139
- if err != nil {
138
+ if err := operation .UnmarshalText ([]byte (o )); err != nil {
140
139
return operation , cerrors .Errorf ("couldn't unmarshal record operation" )
141
140
}
142
141
}
@@ -176,6 +175,8 @@ func (o *openCDCUnwrapper) UnwrapKey(structData record.StructuredData) (record.D
176
175
key = k
177
176
case string :
178
177
key = record.RawData {Raw : []byte (k )}
178
+ default :
179
+ return key , cerrors .Errorf ("expected a record.Data or a string, got %T" , k )
179
180
}
180
181
181
182
return key , nil
@@ -212,6 +213,8 @@ func (o *openCDCUnwrapper) UnwrapPayload(structData record.StructuredData) (reco
212
213
Before : nil ,
213
214
After : convertedData ,
214
215
}
216
+ default :
217
+ return payload , cerrors .Errorf ("expected a record.Change or a map[string]interface{}, got %T" , p )
215
218
}
216
219
return payload , nil
217
220
}
@@ -223,8 +226,7 @@ func (o *openCDCUnwrapper) Unwrap(rec record.Record) (record.Record, error) {
223
226
switch d := data .(type ) {
224
227
case record.RawData :
225
228
// unmarshal raw data to structured
226
- err := json .Unmarshal (data .Bytes (), & structData )
227
- if err != nil {
229
+ if err := json .Unmarshal (data .Bytes (), & structData ); err != nil {
228
230
return record.Record {}, cerrors .Errorf ("failed to unmarshal raw data as JSON: %w" , unwrapProcType , err )
229
231
}
230
232
case record.StructuredData :
0 commit comments