fix: Improve error handling for malformed records in SQLite storage

This commit is contained in:
Alexandr Stelnykovych
2025-09-03 12:44:43 +03:00
parent ce52869945
commit c14eb43605
3 changed files with 9 additions and 8 deletions

View File

@@ -168,7 +168,7 @@ func (db *SQLite) putRecord(r record.Record, tx *bob.Tx) (record.Record, error)
if r.IsWrapped() {
wrapper, ok := r.(*record.Wrapper)
if !ok {
return nil, errors.New("record is malformed (reports to be wrapped but is not of type *record.Wrapper)")
return nil, fmt.Errorf("%w: reports to be wrapped but is not of type *record.Wrapper", storage.ErrRecordMalformed)
}
format, ok = dsd.ValidateSerializationFormat(wrapper.Format)
if !ok {