Commit 55fbe198 authored by Vadim's avatar Vadim

Entry in error_log only when errors occur

parent 277650a7
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: ambulance * User: ambulance
* Date: 03.05.19 * Date: 07.05.19
* Time: 20:30 * Time: 23:00
*/ */
namespace Etersoft\Typos; namespace Etersoft\Typos;
...@@ -151,11 +151,10 @@ abstract class TyposClientInterface ...@@ -151,11 +151,10 @@ abstract class TyposClientInterface
// Trying to replace typo in text // Trying to replace typo in text
try { try {
error_log("Trying to find a typo in article text...");
$article->text = $this->replaceTypoInText($typo, $corrected, $context, $article->text); $article->text = $this->replaceTypoInText($typo, $corrected, $context, $article->text);
return; return;
} catch (\Exception $e) { } catch (\Exception $e) {
error_log($e->getMessage()); error_log("Error while find a typo in article text. ".$e->getMessage());
// If a corrected of the typo is found in the text, remember this and, // If a corrected of the typo is found in the text, remember this and,
// if in other parts (title and subtitle) the typo or context is not found, // if in other parts (title and subtitle) the typo or context is not found,
...@@ -173,11 +172,10 @@ abstract class TyposClientInterface ...@@ -173,11 +172,10 @@ abstract class TyposClientInterface
// Trying to replace typo in title // Trying to replace typo in title
try { try {
error_log("Trying to find a typo in article title...");
$article->title = $this->replaceTypoInText($typo, $corrected, $context, $article->title); $article->title = $this->replaceTypoInText($typo, $corrected, $context, $article->title);
return; return;
} catch (\Exception $e) { } catch (\Exception $e) {
error_log($e->getMessage()); error_log("Error while find a typo in article title. ".$e->getMessage());
if ($e->getCode() == 208) { if ($e->getCode() == 208) {
$isAlreadyFixed = true; $isAlreadyFixed = true;
} }
...@@ -188,9 +186,9 @@ abstract class TyposClientInterface ...@@ -188,9 +186,9 @@ abstract class TyposClientInterface
// Trying to replace typo in subtitle // Trying to replace typo in subtitle
try { try {
error_log("Trying to find a typo in article subtitle...");
$article->subtitle = $this->replaceTypoInText($typo, $corrected, $context, $article->subtitle); $article->subtitle = $this->replaceTypoInText($typo, $corrected, $context, $article->subtitle);
} catch (\Exception $e) { } catch (\Exception $e) {
error_log("Error while find a typo in article subtitle. ".$e->getMessage());
if (($e->getCode() == 404 || $e->getCode() == 405) && $isAlreadyFixed) { if (($e->getCode() == 404 || $e->getCode() == 405) && $isAlreadyFixed) {
throw new \Exception("Already fixed", 208); throw new \Exception("Already fixed", 208);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment