Skip to content

Commit 8542fa4

Browse files
committed
Diff: show path on LibFoundAtUnexpectedPath error
1 parent 5de9857 commit 8542fa4

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/UnisonShare/BranchDiffState.elm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type DiffError
2727
, constructorName2 : FQN
2828
}
2929
| StrayConstructor { culprit : DiffErrorCulprit, constructorName : FQN }
30-
| LibFoundAtUnexpectedPath
30+
| LibFoundAtUnexpectedPath { path : FQN }
3131
| UnknownError
3232

3333

@@ -74,6 +74,10 @@ decodeDiffError =
7474
makeStrayConstructor culprit ctor =
7575
StrayConstructor
7676
{ culprit = culprit, constructorName = ctor }
77+
78+
makeLibFoundAtUnexpectedPath path =
79+
LibFoundAtUnexpectedPath
80+
{ path = path }
7781
in
7882
Decode.oneOf
7983
[ whenTagIs "impossibleError"
@@ -102,7 +106,7 @@ decodeDiffError =
102106
(Decode.field "constructorName" FQN.decode)
103107
)
104108
, whenTagIs "libFoundAtUnexpectedPath"
105-
(Decode.succeed LibFoundAtUnexpectedPath)
109+
(Decode.map makeLibFoundAtUnexpectedPath (Decode.field "path" FQN.decode))
106110
, Decode.succeed UnknownError
107111
]
108112

src/UnisonShare/Page/ProjectContributionChangesPage.elm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,10 @@ view appContext projectRef contribution model =
995995
, text " branch."
996996
]
997997

998-
BranchDiffState.LibFoundAtUnexpectedPath ->
998+
BranchDiffState.LibFoundAtUnexpectedPath { path } ->
999999
Just
1000-
[ text "lib namespace found at unexpected path."
1000+
[ text "lib namespace found at unexpected path: "
1001+
, FQN.view path
10011002
]
10021003

10031004
_ ->

tests/e2e/TestHelpers/Data.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ type DiffErrorDetails =
232232
tag: "strayConstructor";
233233
oldOrNewBranch: DiffErrorCulprit;
234234
constructorName: string;
235+
}
236+
| {
237+
tag: "libFoundAtUnexpectedPath";
238+
path: string;
235239
};
236240

237241
type ContributionDiffConfig =

0 commit comments

Comments
 (0)