CodeIgniter Forums
whoops page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: whoops page (/showthread.php?tid=82520)



whoops page - pws - 07-19-2022

Hello,
i use an package from github: https://github.com/fattureincloud/fattureincloud-php-sdk
and i integrate it correctly.. 
my problem is when use it in a specefic conditions my website return the "whoops page" although i use the Exception!
my code is: 
PHP Code:
$config FattureInCloud\Configuration::getDefaultConfiguration()->setAccessToken('tokenvalue');


 
$apiInstance = new FattureInCloud\Api\ClientsApi(
 
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
 // This is optional, `GuzzleHttp\Client` will be used as default.
 
new GuzzleHttp\Client(),
 
$config
 
);
 
$company_id 12345678// int | The ID of the company.

$q 'vat_number=xxxxx'// string | Query for filtering the results.
  
try {
    $result $apiInstance->listClients($company_id$fields$fieldset$sort$page$per_page$q);
    print_r($result);
} catch (
Exception $e) {
    echo 'Exception when calling ClientsApi->listClients: '$e->getMessage(), PHP_EOL;


in error log i see this: 
resulted in a `422 Unprocessable Entity` response:

{"error":{"message":"Invalid query syntax.","validation_result":null}}

My questio is:
How i change the whoops page by the error message returned?! because i not need by script stopped and must continue working with diplayong error message!
thanks..


RE: whoops page - kenjis - 07-24-2022

Whoops page means there is an uncaught exception.

Catch the exception correctly and do what you want.


RE: whoops page - chakycool - 07-26-2022

Whoops page will come only on production mode which stops displaying unwonted backend info.
I would recommend switching the environment to development and read the error to sort out the problem.


RE: whoops page - superior - 07-27-2022

On a small guess, I think the namespaces conflict which will give you a HTTP 500, if you put the environment on 'development' you should be able to see this.