From 41a83104e357ce8a82925830a228925fe836a785 Mon Sep 17 00:00:00 2001 From: Marco Schaefer <47627413+codecapitano@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:32:26 +0200 Subject: [PATCH] fix(Faro): Exception context got lost while transforming Faro exceptions. (#1413) Co-authored-by: Paschalis Tsilias --- CHANGELOG.md | 4 ++++ internal/component/faro/receiver/sourcemaps.go | 1 + internal/component/faro/receiver/sourcemaps_test.go | 3 +++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88103cb457..8b50578640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ internal API changes are not present. Main (unreleased) ----------------- +### Bugfixes + +- Fixed an issue which caused loss of context data in Faro exception. (@codecapitano) + v1.3.0 ----------------- diff --git a/internal/component/faro/receiver/sourcemaps.go b/internal/component/faro/receiver/sourcemaps.go index eb8e947df0..6b75aaab45 100644 --- a/internal/component/faro/receiver/sourcemaps.go +++ b/internal/component/faro/receiver/sourcemaps.go @@ -342,6 +342,7 @@ func transformException(log log.Logger, store sourceMapsStore, ex *payload.Excep Value: ex.Value, Stacktrace: &payload.Stacktrace{Frames: frames}, Timestamp: ex.Timestamp, + Context: ex.Context, } } diff --git a/internal/component/faro/receiver/sourcemaps_test.go b/internal/component/faro/receiver/sourcemaps_test.go index e06387137e..160c7e900b 100644 --- a/internal/component/faro/receiver/sourcemaps_test.go +++ b/internal/component/faro/receiver/sourcemaps_test.go @@ -231,6 +231,7 @@ func Test_sourceMapsStoreImpl_ReadFromFileSystem(t *testing.T) { }, }, }, + Context: payload.ExceptionContext{"ReactError": "Annoying Error", "component": "ReactErrorBoundary"}, } actual := transformException(logger, store, &payload.Exception{ @@ -262,9 +263,11 @@ func Test_sourceMapsStoreImpl_ReadFromFileSystem(t *testing.T) { }, }, }, + Context: payload.ExceptionContext{"ReactError": "Annoying Error", "component": "ReactErrorBoundary"}, }, "123") require.Equal(t, expect, actual) + require.EqualValues(t, payload.ExceptionContext{"ReactError": "Annoying Error", "component": "ReactErrorBoundary"}, actual.Context) } func Test_sourceMapsStoreImpl_ReadFromFileSystemAndDownload(t *testing.T) {