title: How to throw error inside riverpod future provider and catch it on error flutter
body: <pre><code>final loginProvider =
      FutureProvider.family&lt;bool, LoginParam&gt;((ref, param) async {
    if (param.sgId == '' || param.password == '') {
      return false;
    }
    final http.Response response =
        await APIClient().login(param.sgId, param.password);
    if (response.statusCode == 200) {
      await APIClient().saveTokens(response);
      UserDefaultEntity entity =
          await ref.watch(userDefaultsProvider(param.sgId).future);
      //ref.state = AsyncValue.data(true);
      return true;
    } else {
      throw Exception(jsonDecode(response.body)['message'] ?? 'Unknown Error');
    }
  });
  </code></pre>
  <pre><code>  void login(String userName, String password) async {
      state = AsyncValue.loading();
      AsyncValue&lt;bool&gt; result;
      try {
        result = await ref.refresh(loginProvider(LoginParam(userName, password)));
        state = result;
      } catch (e) {
        state = AsyncError(e);
      }
    }
  </code></pre>
  <p>I'm trying to throw an custom exception inside riverpod future provider and catch the exception in other state notifier classes, but the catch block is not triggered.
  Is there any other way to handle exceptions that future provider throw.</p>