From 8542fa433e445e794a6f058cbc294438abb7a55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8jberg?= Date: Thu, 5 Jun 2025 14:53:29 -0400 Subject: [PATCH] Diff: show path on LibFoundAtUnexpectedPath error --- src/UnisonShare/BranchDiffState.elm | 8 ++++++-- src/UnisonShare/Page/ProjectContributionChangesPage.elm | 5 +++-- tests/e2e/TestHelpers/Data.ts | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/UnisonShare/BranchDiffState.elm b/src/UnisonShare/BranchDiffState.elm index c9643f4b..df98637b 100644 --- a/src/UnisonShare/BranchDiffState.elm +++ b/src/UnisonShare/BranchDiffState.elm @@ -27,7 +27,7 @@ type DiffError , constructorName2 : FQN } | StrayConstructor { culprit : DiffErrorCulprit, constructorName : FQN } - | LibFoundAtUnexpectedPath + | LibFoundAtUnexpectedPath { path : FQN } | UnknownError @@ -74,6 +74,10 @@ decodeDiffError = makeStrayConstructor culprit ctor = StrayConstructor { culprit = culprit, constructorName = ctor } + + makeLibFoundAtUnexpectedPath path = + LibFoundAtUnexpectedPath + { path = path } in Decode.oneOf [ whenTagIs "impossibleError" @@ -102,7 +106,7 @@ decodeDiffError = (Decode.field "constructorName" FQN.decode) ) , whenTagIs "libFoundAtUnexpectedPath" - (Decode.succeed LibFoundAtUnexpectedPath) + (Decode.map makeLibFoundAtUnexpectedPath (Decode.field "path" FQN.decode)) , Decode.succeed UnknownError ] diff --git a/src/UnisonShare/Page/ProjectContributionChangesPage.elm b/src/UnisonShare/Page/ProjectContributionChangesPage.elm index 192704bf..de4fccef 100644 --- a/src/UnisonShare/Page/ProjectContributionChangesPage.elm +++ b/src/UnisonShare/Page/ProjectContributionChangesPage.elm @@ -995,9 +995,10 @@ view appContext projectRef contribution model = , text " branch." ] - BranchDiffState.LibFoundAtUnexpectedPath -> + BranchDiffState.LibFoundAtUnexpectedPath { path } -> Just - [ text "lib namespace found at unexpected path." + [ text "lib namespace found at unexpected path: " + , FQN.view path ] _ -> diff --git a/tests/e2e/TestHelpers/Data.ts b/tests/e2e/TestHelpers/Data.ts index cbc2fa49..3298ab11 100644 --- a/tests/e2e/TestHelpers/Data.ts +++ b/tests/e2e/TestHelpers/Data.ts @@ -232,6 +232,10 @@ type DiffErrorDetails = tag: "strayConstructor"; oldOrNewBranch: DiffErrorCulprit; constructorName: string; + } + | { + tag: "libFoundAtUnexpectedPath"; + path: string; }; type ContributionDiffConfig =