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

How to get GraphQL error objects using GraphQLView in 2.0.0?

Đang mở
#61 1 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ó
4/5
Thời gian dự kiến
3-5 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ệ
flask, graphql, python
Lĩnh vực
api, backend

Hướng nghiên cứu

Kiểm tra việc tái cấu trúc GraphQLView trong phiên bản 2.0.0, đặc biệt là dispatch_request, và so sánh với đường dẫn execute_graphql_request trước đây được mô tả trong issue. Xác định liệu view đã được tái cấu trúc có thể cung cấp các đối tượng lỗi ban đầu và stack trace cho việc báo cáo bằng Raygun hay không; được xem là hoàn tất khi các lỗi vẫn còn khả dụng trước khi tuần tự hóa JSON.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hello,

We are using this library to add graphql support to our flask app. We used to have version 1.3.1 installed and the following view code was working correctly:

class AppGraphQLView(GraphQLView):
    def execute_graphql_request(self, *args, **kwargs):
        """Extract any exceptions and send them to Raygun"""
        result = super().execute_graphql_request(*args, **kwargs)

        if result is not None and result.errors:
            send_errors_to_raygun(result.errors)

        return result

We've recently updated to version 2.0.0 of this library, and this caused our errors to not be sent to raygun, because our function is no longer called.. I discovered that the whole of GraphQLView has been refactored to not include execute_graphql_request anymore so I tried using dispatch_request instead.

However, dispatch_request returns a json object and any errors have only the message, no stacktrace or any other important information we would need to send to raygun.

I have tried to replicate this functionality without overwriting GraphQLView's implementation of execute_graphql_request, by using middleware instead:

def error_reporting_middleware(next, root, info, **kwargs):

    result = next(root, info, **kwargs)

    if result.is_rejected:
        send_errors_to_raygun([result.reason])

    return result

This kinda works, but I was wondering if there is a similar way to do it using the refactored GraphQLView in v2.0.0.

Thanks!

Ngôn ngữ chính
Python
Star
1.3k
Fork
139
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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 graphql-python/flask-graphql

Tất cả issue của graphql-python/flask-graphql

Issue tương tự

Thêm issue về Python

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.