dataProvider delete method only throw Internal Server Error message for errors
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
Hướng nghiên cứu
Bắt đầu với đường dẫn xóa của dataProvider và các vị trí của fetchHydra.js và HttpError.js được hiển thị trong console stack. So sánh cách xử lý lỗi khi xóa với các đường dẫn PUT, POST và GET, sau đó xác minh rằng phản hồi lỗi HTTP chứa hydra:description sẽ tạo ra thông báo đó thay vì lỗi máy chủ nội bộ chung.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
API Platform Admin version(s) affected: 3.4.5
Description
Using the useDelete hook, APIP-Admin only throw an 'Internal Server Error' error, even if the API return an error message.
For example, on the API side I have this:
throw new EntityDeleteForeignKeyException(
$this->translator->trans(
'error.entity.my_entity.delete.has_foreign_key',
[
'%my_entity%' => $item->value,
'%entity_linked%' => $this->translator->trans('entity.my_other_entity'),
]
)
);
This code return a 409 http status code, with the following body:
"@context": "/contexts/Error"
"@type": "hydra:Error"
"hydra:description": "My Error Message"
"hydra:title": "An error occurred"
Wich is at this point the intended behavior so there is no problem.
But then, on the admin side, when we delete the entity and we get a 409 response (in fact, no matter the status code, the result is the same for every HTTP errors), the APIP-admin dataProvider thrown an internal server error and does not take the hydra:description like it do with other methods (PUT, POST, GET...).
This is what is shown in the console when this occurs:
Error
at new HttpError (HttpError.js:33:23)
at eval (fetchHydra.js:53:39)
Aditionnal Context:
- If I remember well, the same type of error happens a while back, when the delete method return a 204 status (maybe it is linked to this https://github.com/api-platform/admin/issues/440)
- This may be a duplicate of this issue: https://github.com/api-platform/admin/issues/381, but as there where no activity since 2021, I didn't knew if it was ok to just add a comment or if I needed to create a new one
- Ngôn ngữ chính
- TypeScript
- Star
- 516
- Fork
- 134
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của api-platform/admin
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
api-platform/admin#616 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 64/100
api-platform/admin#660 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
api-platform/admin#659 · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
api-platform/admin#631 · 6 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/admin#626 · 1 bình luận · 1 reaction ·
Tất cả issue của api-platform/admin
Issue tương tự
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Crush Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/cln-application#167 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Quantco/pnpm-licenses#17 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100