Attaching a patch to log the exception properly. I know the code is exactly s...

Contribution Date
Technology
Contribution Project
Contribution Details

Attaching a patch to log the exception properly. I know the code is exactly same as the other catch blocks but I assume they are there for a reason and so I added a new catch block to catch \Exception and didn't modify the existing catch (InvalidCredentials $e) block.

Ideally, I think the whole code block can just boil down to this:

try { $provider = $this->providerPluginManager->createInstance($plugin_id, $plugins_options[$plugin_id]); return $provider->reverse($latitude, $longitude); } catch (\Exception $e) { static::log($e->getMessage()); }

Even if the logging has to vary for different types of exceptions, that can be done above by just adding more catch blocks.

try { $provider = $this->providerPluginManager->createInstance($plugin_id, $plugins_options[$plugin_id]); return $provider->reverse($latitude, $longitude); } catch (InvalidCredentials $e) { static::log($e->getMessage()); } catch (PluginException $e) { static::log($e->getMessage()); } catch (\Exception $e) { static::log($e->getMessage()); }

If above is preferable, I am happy to modify the patch.

Issue Status
Needs Review
Contribution Author
Files count
1
Patches count
1