I need to access an instance of JImage in a template and when calling


want to catch InvalidArgumentException in case the image file is not on disk.

I tried:

    echo $image->getPath();
}catch (Exception $e){
    $test = 1;

But instead of catching the Exception the debugger always leads me to

/libraries/cms/error/page.php, function render(Exception $error)

What am I doing wrong?

1 Answer 1


get->Path() method actually does not throw an Exception, so you can not catch it. InvalidArgumentException is thrown in loadFile() method, so may be you should use it for your check.

  • Absolutely correct, thanks for pointing this out.
    – jdog
    Commented Jul 23, 2014 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.