File tree Expand file tree Collapse file tree 4 files changed +53
-29
lines changed Expand file tree Collapse file tree 4 files changed +53
-29
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,19 @@ import 'package:flutter_policy_engine/src/exceptions/i_policy_sdk_exceptions.dar
8
8
/// the specific key that failed, the original error, and any additional
9
9
/// validation errors.
10
10
class JsonParseException implements IDetailPolicySDKException {
11
+ /// Creates a new JsonParseException.
12
+ ///
13
+ /// [message] should describe the parsing failure.
14
+ /// [key] optionally specifies which JSON key caused the failure.
15
+ /// [originalError] optionally provides the original parsing error.
16
+ /// [errors] optionally provides a map of field-specific validation errors.
17
+ JsonParseException (
18
+ this .message, {
19
+ this .key,
20
+ this .originalError,
21
+ this .errors,
22
+ });
23
+
11
24
@override
12
25
final String message;
13
26
@@ -23,19 +36,6 @@ class JsonParseException implements IDetailPolicySDKException {
23
36
@override
24
37
final Map <String , String >? errors;
25
38
26
- /// Creates a new JsonParseException.
27
- ///
28
- /// [message] should describe the parsing failure.
29
- /// [key] optionally specifies which JSON key caused the failure.
30
- /// [originalError] optionally provides the original parsing error.
31
- /// [errors] optionally provides a map of field-specific validation errors.
32
- JsonParseException (
33
- this .message, {
34
- this .key,
35
- this .originalError,
36
- this .errors,
37
- });
38
-
39
39
@override
40
40
String toString () {
41
41
final buffer = StringBuffer ('JsonParseException: $message ' );
Original file line number Diff line number Diff line change @@ -7,6 +7,19 @@ import 'package:flutter_policy_engine/src/exceptions/i_policy_sdk_exceptions.dar
7
7
/// occurs when policy objects contain non-serializable data types
8
8
/// or circular references.
9
9
class JsonSerializeException implements IDetailPolicySDKException {
10
+ /// Creates a new JsonSerializeException.
11
+ ///
12
+ /// [message] should describe the serialization failure.
13
+ /// [key] optionally specifies which object key caused the failure.
14
+ /// [originalError] optionally provides the original serialization error.
15
+ /// [errors] optionally provides a map of field-specific serialization errors.
16
+ JsonSerializeException (
17
+ this .message, {
18
+ this .key,
19
+ this .originalError,
20
+ this .errors,
21
+ });
22
+
10
23
@override
11
24
final String message;
12
25
@@ -22,19 +35,6 @@ class JsonSerializeException implements IDetailPolicySDKException {
22
35
@override
23
36
final Map <String , String >? errors;
24
37
25
- /// Creates a new JsonSerializeException.
26
- ///
27
- /// [message] should describe the serialization failure.
28
- /// [key] optionally specifies which object key caused the failure.
29
- /// [originalError] optionally provides the original serialization error.
30
- /// [errors] optionally provides a map of field-specific serialization errors.
31
- JsonSerializeException (
32
- this .message, {
33
- this .key,
34
- this .originalError,
35
- this .errors,
36
- });
37
-
38
38
@override
39
39
String toString () {
40
40
final buffer = StringBuffer ('JsonSerializeException: $message ' );
Original file line number Diff line number Diff line change @@ -15,13 +15,15 @@ import 'package:flutter_policy_engine/src/exceptions/i_policy_sdk_exceptions.dar
15
15
/// }
16
16
/// ```
17
17
class PolicyNotInitializedException implements IPolicySDKException {
18
+ /// Creates a new [PolicyNotInitializedException] with the given [message] .
19
+ const PolicyNotInitializedException (
20
+ this .message,
21
+ );
22
+
18
23
/// A message describing the initialization error.
19
24
@override
20
25
final String message;
21
26
22
- /// Creates a new [PolicyNotInitializedException] with the given [message] .
23
- const PolicyNotInitializedException (this .message);
24
-
25
27
@override
26
28
String toString () {
27
29
final buffer = StringBuffer ('PolicyNotInitializedException: $message ' );
Original file line number Diff line number Diff line change
1
+ import 'package:flutter_policy_engine/src/exceptions/i_policy_sdk_exceptions.dart' ;
2
+
3
+ class PolicySDKException implements IPolicySDKException {
4
+ PolicySDKException (
5
+ this .message, {
6
+ required this .exception,
7
+ });
8
+
9
+ @override
10
+ final String message;
11
+
12
+ final Exception ? exception;
13
+
14
+ @override
15
+ String toString () {
16
+ final buffer = StringBuffer ('SDKException: $message ' );
17
+ if (exception != null ) {
18
+ buffer.write ('\n Extra info: ${exception ?.toString ()}' );
19
+ }
20
+ return buffer.toString ();
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments