mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 01:41:05 +01:00
Catch any errors that might happen when calling handleUpdateExerciseFromApi
This seems to mostly happen when the app is running (or is moved) to the background
This commit is contained in:
@@ -314,14 +314,21 @@ class ExercisesProvider with ChangeNotifier {
|
||||
// Note: no await since we don't care for the updated data right now. It
|
||||
// will be written to the db whenever the request finishes and we will get
|
||||
// the updated exercise the next time
|
||||
handleUpdateExerciseFromApi(database, exerciseId).then(
|
||||
(_) {},
|
||||
onError: (error, stackTrace) => _logger.info(
|
||||
'Error while calling unawaited handleUpdateExerciseFromApi',
|
||||
error,
|
||||
stackTrace,
|
||||
),
|
||||
);
|
||||
try {
|
||||
handleUpdateExerciseFromApi(database, exerciseId).then(
|
||||
(_) {},
|
||||
onError: (error, stackTrace) => _logger.info(
|
||||
'Error while calling unawaited handleUpdateExerciseFromApi',
|
||||
error,
|
||||
stackTrace,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
// This is here just to catch any errors that seem to happen when the app is running
|
||||
// in the background: https://github.com/wger-project/wger/issues/2206
|
||||
|
||||
_logger.info('Error while calling handleUpdateExerciseFromApi:', e);
|
||||
}
|
||||
|
||||
return exercise;
|
||||
} on NoSuchEntryException {
|
||||
|
||||
Reference in New Issue
Block a user