Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format exception log for Elasticsearch #1393

Closed
wants to merge 3 commits into from

Conversation

Quynh-Nguyen
Copy link

@Quynh-Nguyen Quynh-Nguyen commented Oct 30, 2019

For resolving the issues when working with Laravel

Class Error: QueryException

        "status" => 400
        "error" => array:3 [
          "type" => "mapper_parsing_exception"
          "reason" => "failed to parse field [context.exception.code] of type [long] in document with id 'sPh3G24Bss4rAxTOzNRI'"
          "caused_by" => array:2 [
            "type" => "illegal_argument_exception"
            "reason" => "For input string: "42S22""
          ]
        ]

Or got the error the message log too long.

@Seldaek
Copy link
Owner

Seldaek commented Nov 7, 2019

It seems from your error message that the problem is the exception's getCode() returned a long instead of int. That seems to be due to PDOException returning error codes as strings. I guess NormalizerFormatter should cast the code to int which would fix it at the source.

@Quynh-Nguyen
Copy link
Author

@Seldaek
Yes I understood sir.
Beside the getCode() return long instead of int. The QueryException also sending the previous exception which make the exception message too long for sending to Elasticsearch.
Let me update my pull request.

@Seldaek Seldaek closed this in cf77550 Nov 12, 2019
@Seldaek Seldaek added this to the 1.x milestone Nov 12, 2019
@Seldaek Seldaek added the Bug label Nov 12, 2019
@Seldaek
Copy link
Owner

Seldaek commented Nov 12, 2019

I fixed the type error at least. The length one I am not sure we can do much about, as this is kind of dependent on the exact exception and content of what you log?

@lyrixx lyrixx mentioned this pull request Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants