Welcome Guest, Not a member yet? Register   Sign In
Exceptions exceptions...
#8

(This post was last modified: 04-20-2020, 10:39 AM by Leo. Edit Reason: found solution )

I figured it out. It was a very dumb mistake on my part. I develop in English, with my comments, etc. in English. But I make Russian websites. So when I switched language in app/config - back to english - EVERYTHING WORKED AS EXPECTED.

However this mistake brought me back to my comment from 9 hours ago.

if(substr($e, 0, 66) === 'CodeIgniter\Images\Exceptions\ImageException: Your server does not') {
          $validation->setError('img_path', lang('mixed.imageException', [], 'custom'));
}

This solution is flawed. I shouldn't match my exception with string contained in $e...I somehow have to figure out another way to figure out if its an exception from forInvalidImageCreate. For now, I'll just have to check for string in English and Russian until I figure out an easier way to catch/figure out exceptions.

UPDATE: solution:
PHP Code:
try {
     $new_images $simpleImg->upload();
} catch (
ImageException $e) {
     //forInvalidImageCreate
     if(strpos($elang('Images.unsupportedImageCreate'))) {
          $validation->setError('img_path'lang('mixed.imageException', [], 'custom'));
     }

You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
Reply


Messages In This Thread
Exceptions exceptions... - by Gary - 04-17-2020, 07:07 AM
RE: Exceptions exceptions... - by Leo - 04-19-2020, 02:08 PM
RE: Exceptions exceptions... - by Gary - 04-19-2020, 04:20 PM
RE: Exceptions exceptions... - by Leo - 04-20-2020, 12:12 AM
RE: Exceptions exceptions... - by Gary - 04-20-2020, 02:56 AM
RE: Exceptions exceptions... - by Leo - 04-20-2020, 06:05 AM
RE: Exceptions exceptions... - by Gary - 04-20-2020, 06:52 AM
RE: Exceptions exceptions... - by Leo - 04-20-2020, 10:31 AM
RE: Exceptions exceptions... - by Gary - 04-20-2020, 01:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB