mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-21 05:38:42 -04:00
remove things that fail to deserialize
This commit is contained in:
parent
2344184620
commit
f8977147f6
4 changed files with 36 additions and 9 deletions
|
@ -40,6 +40,13 @@ sealed class LocalAccount with _$LocalAccount {
|
|||
required String name,
|
||||
}) = _LocalAccount;
|
||||
|
||||
factory LocalAccount.fromJson(dynamic json) =>
|
||||
_$LocalAccountFromJson(json as Map<String, dynamic>);
|
||||
factory LocalAccount.fromJson(dynamic json) {
|
||||
try {
|
||||
return _$LocalAccountFromJson(json as Map<String, dynamic>);
|
||||
// Need to catch any errors here too
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
} catch (e, st) {
|
||||
throw Exception('invalid local account: $e\n$st');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,13 @@ sealed class UserLogin with _$UserLogin {
|
|||
required Timestamp lastActive,
|
||||
}) = _UserLogin;
|
||||
|
||||
factory UserLogin.fromJson(dynamic json) =>
|
||||
_$UserLoginFromJson(json as Map<String, dynamic>);
|
||||
factory UserLogin.fromJson(dynamic json) {
|
||||
try {
|
||||
return _$UserLoginFromJson(json as Map<String, dynamic>);
|
||||
// Need to catch any errors here too
|
||||
// ignore: avoid_catches_without_on_clauses
|
||||
} catch (e, st) {
|
||||
throw Exception('invalid user login: $e\n$st');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue