Skip to content

Commit

Permalink
BadRequest exception handling was added (#1894)
Browse files Browse the repository at this point in the history
* BadRequest exception handling was added
Some translations were changed(#1892)

* Some translations were changed(#1890)

Co-authored-by: Sergey Suvorov <sergey.suvorov@odysseusinc.com>
  • Loading branch information
ssuvorov-fls and ssuvorov-fls committed Jun 15, 2021
1 parent 6c09816 commit 4c53959
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.messaging.support.ErrorMessage;

import javax.ws.rs.BadRequestException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
Expand Down Expand Up @@ -57,6 +58,8 @@ public Response toResponse(Throwable ex) {
responseStatus = Status.FORBIDDEN;
} else if (ex instanceof NotFoundException) {
responseStatus = Status.NOT_FOUND;
} else if (ex instanceof BadRequestException) {
responseStatus = Status.BAD_REQUEST;
} else if (ex instanceof UserException) {
responseStatus = Status.INTERNAL_SERVER_ERROR;
// Create new message to prevent sending error information to client
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/i18n/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2619,9 +2619,9 @@
"sampleName": "* Sample name",
"sampleNamePlaceholder": "Enter sample name",
"sampleNameEmpty": "Sample name cannot be empty",
"numberOfPatients": "* Number of patients",
"numberOfPatients": "* Number of patients (from 1 to 500)",
"numberOfPatientsPlaceholder": "Enter a number",
"numberOfPatientsEmpty": "Number of patients must be a positive integer",
"numberOfPatientsEmpty": "Number of patients must be a positive integer between 1 and 500",
"selectAgeCriteria": "Select age criteria",
"lessThan": "Less than",
"lessOrEqualTo": "Less or equal to",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/i18n/messages_ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2619,9 +2619,9 @@
"sampleName": "* 샘플 이름",
"sampleNamePlaceholder": "샘플 이름 입력",
"sampleNameEmpty": "샘플 이름은 비워 둘 수 없습니다",
"numberOfPatients": "* 환자 수",
"numberOfPatients": "* Number of patients (from 1 to 500)",
"numberOfPatientsPlaceholder": "숫자 입력",
"numberOfPatientsEmpty": "환자 수는 양의 정수여야 합니다",
"numberOfPatientsEmpty": "Number of patients must be a positive integer between 1 and 500",
"selectAgeCriteria": "나이 기준 선택",
"lessThan": "보다 작은",
"lessOrEqualTo": "보다 작거나 같은",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/i18n/messages_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2619,9 +2619,9 @@
"sampleName": "* Имя образца",
"sampleNamePlaceholder": "Введите имя образца",
"sampleNameEmpty": "Имя образца не может быть пустым",
"numberOfPatients": "* Количество пациентов",
"numberOfPatients": "* Количество пациентов (от 1 до 500)",
"numberOfPatientsPlaceholder": "Введите число",
"numberOfPatientsEmpty": "Количество пациентов должно быть положительным числом",
"numberOfPatientsEmpty": "Количество пациентов должно быть положительным числом от 1 до 500",
"selectAgeCriteria": "Выберите возрастной критерий",
"lessThan": "Менее чем",
"lessOrEqualTo": "Менее чем или равно",
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/i18n/messages_zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2619,9 +2619,9 @@
"sampleName": "*样本名称",
"sampleNamePlaceholder": "输入样本名称",
"sampleNameEmpty": "样本名称不能为空",
"numberOfPatients": "*患者数量",
"numberOfPatients": "* Number of patients (from 1 to 500)",
"numberOfPatientsPlaceholder": "输入一个数字",
"numberOfPatientsEmpty": "患者数量必须正整数",
"numberOfPatientsEmpty": "Number of patients must be a positive integer between 1 and 500",
"selectAgeCriteria": "选择年龄标准",
"lessThan": "小于",
"lessOrEqualTo": "小于等于",
Expand Down

0 comments on commit 4c53959

Please sign in to comment.