Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception has occurred. DataException (errorBadRequest) #12

Open
Zohalmohal opened this issue May 17, 2022 · 1 comment
Open

Exception has occurred. DataException (errorBadRequest) #12

Zohalmohal opened this issue May 17, 2022 · 1 comment

Comments

@Zohalmohal
Copy link

Hello!
I tried to run your code but it gives me the following error:


Exception has occurred.
DataException (errorBadRequest)

The error occurs in this part of the code:


final favoritePairProvider = FutureProvider<FavoritePair>((ref) async {
  final cancelToken = CancelToken();
  ref.onDispose(() => cancelToken.cancel());

  final settings = ref.watch(cryptoSettings);
  String exchangeName = settings.maybeWhen(
      data: (details) => details.favoriteExchange, orElse: () => "");
  String pairName = settings.maybeWhen(
      data: (details) => details.favoritePair, orElse: () => "");

  if (exchangeName.isEmpty || pairName.isEmpty) {
    throw DataException(message: LocaleKeys.errorSomethingWentWrong);
  }

  Pair pair = Pair(pair: pairName, exchange: exchangeName);
  try {
    PairSummary pairSummary = await ref
        .read(cryptoRepository)
        .getPairSummary(exchangeName, pairName, cancelToken: cancelToken);
    return FavoritePair(pair: pair, pairSummary: pairSummary);
  } on DataException catch (error) {
    if (error.message == LocaleKeys.errorRequestNotFound) {
      ref.read(cryptoSettings.notifier).verifyFavoritePair();
    }
    throw error;
  }
});

I also changed the .env-example file to .env and copied my gotten API private key like below into it:

API_KEY=ddTaK3jVw5fgdfgdgfdgfgfdgfdgfd

Do you know how can I fix it?

@tehsunnliu
Copy link

You have to use the public key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants