Skip to content

Commit 126d010

Browse files
committed
fix: handle exceptions when collecting structure converters
Refs: #23
1 parent 6519f32 commit 126d010

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/dogs_core/lib/src/structure/harbinger.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,19 @@ class StructureHarbinger<T> {
3131
/// Creates a new [StructureHarbinger] for the supplied [structure] and [engine].
3232
StructureHarbinger(this.structure, this.engine) {
3333
fieldConverters = structure.fields.map((e) {
34-
final fieldConverter = getConverter(engine, structure, e);
35-
return (field: e, converter: fieldConverter);
34+
try {
35+
final fieldConverter = getConverter(engine, structure, e);
36+
return (field: e, converter: fieldConverter);
37+
} on DogException catch (exception, trace) {
38+
throw DogFieldSerializerException(
39+
"Exception occurred while collecting structure converters",
40+
null,
41+
structure,
42+
e,
43+
exception,
44+
trace,
45+
);
46+
}
3647
}).toList();
3748
}
3849

0 commit comments

Comments
 (0)