Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-server
Commits
b8624760
You need to sign in or sign up before continuing.
Commit
b8624760
authored
Aug 27, 2018
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Задача 13121] Улучшил сообщения об ошибках
parent
e601b73d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
Typo.php
cp/application/models/Typo.php
+10
-7
No files found.
cp/application/models/Typo.php
View file @
b8624760
...
@@ -349,12 +349,12 @@ class Typo extends CI_Model {
...
@@ -349,12 +349,12 @@ class Typo extends CI_Model {
$result
=
$client
->
fixTypo
(
$correction
->
text
,
$corrected
,
$correction
->
context
,
$correction
->
link
);
$result
=
$client
->
fixTypo
(
$correction
->
text
,
$corrected
,
$correction
->
context
,
$correction
->
link
);
if
(
!
isset
(
$result
[
"
status
"
]))
{
if
(
!
isset
(
$result
[
"
errorCode
"
]))
{
throw
new
Exception
(
"Неправильный ответ сервера"
);
throw
new
Exception
(
"Неправильный ответ сервера"
,
500
);
}
}
if
(
$result
[
"
status"
]
!=
"success"
)
{
if
(
$result
[
"
errorCode"
]
!=
200
)
{
throw
new
Exception
(
"Не удалось исправить опечатку: "
.
$result
[
"messag
e"
]);
throw
new
Exception
(
$result
[
"message"
],
$result
[
"errorCod
e"
]);
}
}
}
catch
(
ConnectionFailureException
$e
)
{
}
catch
(
ConnectionFailureException
$e
)
{
throw
new
Exception
(
"Не удалось подключиться к серверу исправления опечаток"
,
503
);
throw
new
Exception
(
"Не удалось подключиться к серверу исправления опечаток"
,
503
);
...
@@ -363,7 +363,7 @@ class Typo extends CI_Model {
...
@@ -363,7 +363,7 @@ class Typo extends CI_Model {
}
catch
(
ServerErrorException
$e
)
{
}
catch
(
ServerErrorException
$e
)
{
throw
new
Exception
(
"Ошибка автоматического исправления опечатки на сервере"
,
500
);
throw
new
Exception
(
"Ошибка автоматического исправления опечатки на сервере"
,
500
);
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
log_message
(
"error"
,
"Ошибка при исправлении опечатки:
{
$e
->
getMessage
()
}
"
);
log_message
(
"error"
,
"Ошибка при исправлении опечатки:
{
$e
->
getMessage
()
}
(код
{
$e
->
getCode
()
}
)
"
);
throw
new
Exception
(
$this
->
getExceptionStringForCode
(
$e
->
getCode
()),
$e
->
getCode
());
throw
new
Exception
(
$this
->
getExceptionStringForCode
(
$e
->
getCode
()),
$e
->
getCode
());
}
}
}
}
...
@@ -379,9 +379,12 @@ class Typo extends CI_Model {
...
@@ -379,9 +379,12 @@ class Typo extends CI_Model {
switch
(
$errorCode
)
{
switch
(
$errorCode
)
{
case
404
:
case
404
:
return
"Ошибка в тексте не найдена. Возможно, она уже была исправлена. Проверьте вручную"
;
return
"Ошибка в тексте не найдена. Возможно, она уже была исправлена. Проверьте вручную"
;
break
;
case
405
:
return
"Ошибка. Контекст статьи изменился, автоматическое исправление недоступно. Внесите изменения вручную"
;
case
208
:
return
"Опечатка уже была исправлена автоматически. Изменения применены к тексту"
;
default
:
default
:
return
"Произошла неизвестная ошибка, попробуйте повторить попытку позже"
;
return
"Произошла неизвестная ошибка
на сервере
, попробуйте повторить попытку позже"
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment