Track login errors
This commit is contained in:
parent
5e56c407f7
commit
ff0e364fe7
|
|
@ -88,7 +88,9 @@ Middleware<AppState> _createLoginRequest(AuthRepository repository) {
|
||||||
action.completer.completeError(message);
|
action.completer.completeError(message);
|
||||||
}
|
}
|
||||||
store.dispatch(UserLoginFailure(message));
|
store.dispatch(UserLoginFailure(message));
|
||||||
|
if ('$error'.startsWith('Error ::')) {
|
||||||
throw error;
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
@ -116,7 +118,9 @@ Middleware<AppState> _createSignUpRequest(AuthRepository repository) {
|
||||||
action.completer.completeError(message);
|
action.completer.completeError(message);
|
||||||
}
|
}
|
||||||
store.dispatch(UserLoginFailure(message));
|
store.dispatch(UserLoginFailure(message));
|
||||||
|
if ('$error'.startsWith('Error ::')) {
|
||||||
throw error;
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
@ -150,7 +154,9 @@ Middleware<AppState> _createOAuthLoginRequest(AuthRepository repository) {
|
||||||
action.completer.completeError(message);
|
action.completer.completeError(message);
|
||||||
}
|
}
|
||||||
store.dispatch(UserLoginFailure(message));
|
store.dispatch(UserLoginFailure(message));
|
||||||
|
if ('$error'.startsWith('Error ::')) {
|
||||||
throw error;
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
@ -179,7 +185,9 @@ Middleware<AppState> _createOAuthSignUpRequest(AuthRepository repository) {
|
||||||
action.completer.completeError(message);
|
action.completer.completeError(message);
|
||||||
}
|
}
|
||||||
store.dispatch(UserLoginFailure(message));
|
store.dispatch(UserLoginFailure(message));
|
||||||
|
if ('$error'.startsWith('Error ::')) {
|
||||||
throw error;
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
@ -233,7 +241,9 @@ Middleware<AppState> _createRefreshRequest(AuthRepository repository) {
|
||||||
action.completer.completeError(message);
|
action.completer.completeError(message);
|
||||||
}
|
}
|
||||||
store.dispatch(RefreshDataFailure(message));
|
store.dispatch(RefreshDataFailure(message));
|
||||||
|
if ('$error'.startsWith('Error ::')) {
|
||||||
throw error;
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
next(action);
|
next(action);
|
||||||
|
|
@ -344,7 +354,7 @@ String _parseError(String error) {
|
||||||
if (error.contains(errorPattern)) {
|
if (error.contains(errorPattern)) {
|
||||||
final lastIndex = error.lastIndexOf(errorPattern);
|
final lastIndex = error.lastIndexOf(errorPattern);
|
||||||
final secondToLastIndex = secondToLastIndexOf(error, errorPattern);
|
final secondToLastIndex = secondToLastIndexOf(error, errorPattern);
|
||||||
error = 'Error: ' +
|
error = 'Error :: ' +
|
||||||
error
|
error
|
||||||
.substring(
|
.substring(
|
||||||
(secondToLastIndex >= 0 ? secondToLastIndex : lastIndex) +
|
(secondToLastIndex >= 0 ? secondToLastIndex : lastIndex) +
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue