Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Catch exception when doofinder search fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoslado committed Mar 9, 2016
1 parent 957a6f4 commit 9349ffc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Binary file modified dist/doofinder-p1.5-latest.zip
Binary file not shown.
12 changes: 10 additions & 2 deletions doofinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Doofinder extends Module

const GS_SHORT_DESCRIPTION = 1;
const GS_LONG_DESCRIPTION = 2;
const VERSION = "2.0.19";
const VERSION = "2.0.20";

const YES = 1;
const NO = 0;
Expand Down Expand Up @@ -601,14 +601,22 @@ public function searchOnApi($string,$page=1,$page_size=12,$timeout=8000){


if($hash_id && $api_key){
$fail = false;
try {
$df = new DoofinderApi($hash_id, $api_key);
$dfResults = $df->query($string, $page, array('rpp' => $page_size, // results per page
'timeout' => $timeout, // timeout in milisecs
'types' => array( // types of item
'product',
), 'transformer'=>'dflayer'));
}

catch(Exception $e){
$fail = true;
}

if(!$dfResults->isOk())

if($fail || !$dfResults->isOk())
return false;

$dfResultsArray = $dfResults->getResults();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doofinder-for-prestashop",
"version": "2.0.19",
"version": "2.0.20",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.5.0",
Expand Down

0 comments on commit 9349ffc

Please sign in to comment.