Skip to content

Commit e9fed07

Browse files
Merge co-proposers into feat/proposals_briefs_collaborators_3700
2 parents 3be9893 + 0aa8f2c commit e9fed07

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/signed_document/signed_document_manager_impl.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ final class SignedDocumentManagerImpl implements SignedDocumentManager {
5151
return _CoseSignedDocument(
5252
coseSign: coseSign,
5353
payload: payload,
54-
metadata: metadata.adapt(authors: signers),
54+
metadata: metadata.toModel(authors: signers),
5555
signers: signers,
5656
);
5757
}
@@ -192,13 +192,23 @@ final class _CoseSignedDocument with EquatableMixin implements SignedDocument {
192192
}
193193

194194
extension on SignedDocumentMetadata {
195-
DocumentDataMetadata adapt({
195+
DocumentDataMetadata toModel({
196196
List<CatalystId>? authors,
197197
}) {
198+
final id = this.id;
199+
final ver = this.ver;
200+
201+
if (id == null) {
202+
throw const FormatException('Signed document id was null');
203+
}
204+
if (ver == null) {
205+
throw const FormatException('Signed document ver was null');
206+
}
207+
198208
return DocumentDataMetadata(
199209
contentType: DocumentContentType.json,
200210
type: documentType,
201-
id: SignedDocumentRef(id: id!, ver: ver),
211+
id: SignedDocumentRef(id: id, ver: ver),
202212
ref: ref?.toModel(),
203213
template: template?.toModel(),
204214
reply: reply?.toModel(),

0 commit comments

Comments
 (0)