Comments

arnaldop created an issue. See original summary.

arnaldop’s picture

  • Jiang_2015 committed 373d5e6 on 8.x-1.x authored by arnaldop
    Issue #3087139 by arnaldop, Jiang_2015: When lookup fails, errors appear...
jiang_2015’s picture

Thank you so much for your commit. I appreciate your help. Just committed the code.

jiang_2015’s picture

I think I need to delete the "else" statement. otherwise, it won't send Http request when the user has the correct config.
I set the default API key as "test". default key will let the user use ipdata for a few lookups until they have a right API key.

  • Jiang_2015 committed 0b93b8d on 8.x-1.x
    Issue #3087139 by arnaldop, Jiang_2015: When lookup fails, errors appear...
jiang_2015’s picture

StatusFileSize
new748 bytes

I updated the patch. I handled the error when send the Http request at "fetchProjectData"

  try {
      $response = $this->httpClient->request($method, $url);
      $code = $response->getStatusCode();
      if ($code == 200) {
        $body = $response->getBody()->getContents();
        return $body;
      }
    }
    catch (RequestException $e) {
      watchdog_exception('ip_lookup', $e);
    }

We don't need to try catch again. The error you have onscreen is because I didn't check if $details->ip is empty. I updated the patch.
Thank you again for your help.

  • Jiang_2015 committed 6c7a7f4 on 8.x-1.x
    Issue #3087139 by Jiang_2015, arnaldop: When lookup fails, errors appear...
jiang_2015’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.