66
77import "package:curie/curie.dart" ;
88
9- import "../../exceptions.dart" ;
109import "../additional_expected_response.dart" ;
1110import "../context.dart" ;
1211import "../data_schema.dart" ;
@@ -96,7 +95,7 @@ extension ParseField on Map<String, dynamic> {
9695 }
9796
9897 /// Parses a single field with a given [name] and throws a
99- /// [ValidationException ] if the field is not present or does not have the
98+ /// [FormatException ] if the field is not present or does not have the
10099 /// type [T] .
101100 ///
102101 /// Like [parseField] , it adds the field [name] to the set of [parsedFields] ,
@@ -105,7 +104,7 @@ extension ParseField on Map<String, dynamic> {
105104 final fieldValue = parseField (name, parsedFields);
106105
107106 if (fieldValue is ! T ) {
108- throw ValidationException (
107+ throw FormatException (
109108 "Value for field $name has wrong data type or is missing. "
110109 "Expected ${T .runtimeType }, got ${fieldValue .runtimeType }." ,
111110 );
@@ -115,7 +114,7 @@ extension ParseField on Map<String, dynamic> {
115114 }
116115
117116 /// Parses a single field with a given [name] as a [Uri] and throws a
118- /// [ValidationException ] if the field is not present or cannot be parsed.
117+ /// [FormatException ] if the field is not present or cannot be parsed.
119118 ///
120119 /// If a [Set] of [parsedFields] is passed to this function, the field [name]
121120 /// will added. This can be used for filtering when parsing additional fields.
@@ -284,7 +283,7 @@ extension ParseField on Map<String, dynamic> {
284283 return forms;
285284 }
286285
287- throw const ValidationException (
286+ throw const FormatException (
288287 'Missing "forms" member in InteractionAffordance' ,
289288 );
290289 }
@@ -610,7 +609,7 @@ Iterable<ContextEntry> _parseContextEntries(dynamic json) sync* {
610609 final value = entry.value;
611610
612611 if (value is ! String ) {
613- throw ValidationException (
612+ throw FormatException (
614613 "Expected $value to be a String or a Map<String, String> "
615614 "as @context entry, got ${value .runtimeType } instead." );
616615 }
@@ -625,7 +624,7 @@ Iterable<ContextEntry> _parseContextEntries(dynamic json) sync* {
625624 });
626625 }
627626 default :
628- throw ValidationException (
627+ throw FormatException (
629628 "Expected the @context entry $json to "
630629 "either be a String or a Map<String, String>, "
631630 "got ${json .runtimeType } instead." ,
0 commit comments