Skip to content

Commit 505c587

Browse files
committed
Updated exceptions logic
1 parent 21784f1 commit 505c587

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

lib/src/internal/qonversion_internal.dart

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ class QonversionInternal implements Qonversion {
208208

209209
final result = QMapper.userFromJson(rawResult);
210210
if (result == null) {
211-
throw new Exception("User deserialization failed");
211+
throw QonversionException(
212+
QErrorCode.internalError.code,
213+
"User deserialization failed",
214+
null,
215+
);
212216
}
213217
return result;
214218
}
@@ -224,7 +228,11 @@ class QonversionInternal implements Qonversion {
224228

225229
final result = QMapper.userFromJson(rawResult);
226230
if (result == null) {
227-
throw new Exception("User deserialization failed");
231+
throw QonversionException(
232+
QErrorCode.internalError.code,
233+
"User deserialization failed",
234+
null,
235+
);
228236
}
229237
return result;
230238
}
@@ -238,7 +246,11 @@ class QonversionInternal implements Qonversion {
238246

239247
final result = QMapper.remoteConfigFromJson(rawResult);
240248
if (result == null) {
241-
throw new Exception("Remote config deserialization failed");
249+
throw QonversionException(
250+
QErrorCode.internalError.code,
251+
"Remote config deserialization failed",
252+
null,
253+
);
242254
}
243255
return result;
244256
}
@@ -249,7 +261,11 @@ class QonversionInternal implements Qonversion {
249261

250262
final result = QMapper.remoteConfigListFromJson(rawResult);
251263
if (result == null) {
252-
throw new Exception("Remote config list deserialization failed");
264+
throw QonversionException(
265+
QErrorCode.internalError.code,
266+
"Remote config list deserialization failed",
267+
null,
268+
);
253269
}
254270
return result;
255271
}
@@ -267,7 +283,11 @@ class QonversionInternal implements Qonversion {
267283

268284
final result = QMapper.remoteConfigListFromJson(rawResult);
269285
if (result == null) {
270-
throw new Exception("Remote config list deserialization failed");
286+
throw QonversionException(
287+
QErrorCode.internalError.code,
288+
"Remote config list deserialization failed",
289+
null,
290+
);
271291
}
272292
return result;
273293
}
@@ -351,7 +371,11 @@ class QonversionInternal implements Qonversion {
351371

352372
final result = QMapper.userPropertiesFromJson(rawResult);
353373
if (result == null) {
354-
throw new Exception("User properties deserialization failed");
374+
throw QonversionException(
375+
QErrorCode.internalError.code,
376+
"User properties deserialization failed",
377+
null,
378+
);
355379
}
356380
return result;
357381
}

0 commit comments

Comments
 (0)