Welcome Guest, Not a member yet? Register   Sign In
Prevent gzuncompress to throw ErrorException on invalid data
#1

Hello,
I'm working on an controller in the newest CI-Version to load and uncompress date.
Currently I'm testing on invalid data.
If the data is invalid by a modified data, I put "hello world" in it, CI throws an ErrorException.
ErrorException
gzuncompress(): data error

But I would like to handle the error myself using the return value.
How can I prenvet this?
Try and catch does not work.

PHP Code:
try
{
    $this->Config['OutputContent'] = gzuncompress($OutputContentGZ);
}
catch (
Exception $ex)
{
    return 2022;



Thanks
Stefan
Reply
#2

Found it myself with the docu :-)
using
Code:
\Exception
makes the difference
Code:
try
{
    $this->Config['OutputContent'] = gzuncompress($OutputContentGZ);
}
catch (\Exception $ex)
{
    return 2022;


Stefan
Reply




Theme © iAndrew 2016 - Forum software by © MyBB