withReplacedServerEmailException<T> static method
Replaces server-side exceptions by client-side exceptions, hiding details that could leak account information.
Implementation
static Future<T> withReplacedServerEmailException<T>(
final Future<T> Function() fn,
) async {
try {
return await fn();
} on EmailServerException catch (e) {
switch (e) {
case EmailLoginServerException():
throw EmailAccountLoginException(reason: e.reason);
case EmailAccountRequestServerException():
throw EmailAccountRequestException(reason: e.reason);
case EmailPasswordResetServerException():
throw EmailAccountPasswordResetException(reason: e.reason);
}
}
}