Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

dataProvider delete method only throw Internal Server Error message for errors

Đang mở
#523 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Lĩnh vực
api, frontend

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:

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

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của api-platform/admin

Tất cả issue của api-platform/admin

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.