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

Improve breadcrumb data serialization and handling of ServerError.result #279

Merged
merged 3 commits into from
Feb 18, 2021

Conversation

spawnia
Copy link
Collaborator

@spawnia spawnia commented Feb 16, 2021

Resolves #278

The first part towards solving this issue is recognizing when a thrown error includes a result. I think the correct thing to do in that case is to respect the value of the includeFetchResult configuration and act accordingly.

The second part would be to do deep serialization of certain parts of the breadcrumb. I am not quite sure how that is best handled, especially when considering attachBreadcrumbs.transform - this function expects a breadcrumb that still holds structured data, that should be the most useful to work with. Should we just JSON-stringify every key of the transformed breadcrumb afterwards?

@spawnia spawnia marked this pull request as draft February 16, 2021 11:50
@spawnia
Copy link
Collaborator Author

spawnia commented Feb 16, 2021

@alesso-x @DiederikvandenB

@alesso-x
Copy link

Should we just JSON-stringify every key of the transformed breadcrumb afterwards?

I think this makes sense, as user I don't have to worry about transforming the data myself.

@mic-web
Copy link

mic-web commented Feb 17, 2021

Should we just JSON-stringify every key of the transformed breadcrumb afterwards?

I think this makes sense, as user I don't have to worry about transforming the data myself.

Yes I think that makes sense for the default behavior and for the most usage scenarios. In some rare cases it might also be helpful to have the option of passing a replacer function (which could be forwarded to JSON.stringify):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter

@spawnia spawnia changed the title feat: Include fetchResult from ServerError Improve breadcrumb data serialization and handling of ServerError.result Feb 17, 2021
@spawnia spawnia marked this pull request as ready for review February 17, 2021 11:36
@DiederikvandenB
Copy link
Owner

Thanks @spawnia. I'll merge & release.

@DiederikvandenB DiederikvandenB merged commit 3582fa6 into DiederikvandenB:master Feb 18, 2021
@spawnia spawnia deleted the error-result branch February 18, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

includeError displaying errors as "[Array]"
4 participants