Skip to content

Commit cd831d5

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

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
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: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -211,28 +211,32 @@ type DiffErrorCulprit = "new" | "old";
211211
type DiffErrorDetails =
212212
| { tag: "impossibleError" }
213213
| {
214-
tag: "constructorAlias";
215-
oldOrNewBranch: DiffErrorCulprit;
216-
typeName: string;
217-
constructorName1: string;
218-
constructorName2: string;
219-
}
214+
tag: "constructorAlias";
215+
oldOrNewBranch: DiffErrorCulprit;
216+
typeName: string;
217+
constructorName1: string;
218+
constructorName2: string;
219+
}
220220
| {
221-
tag: "missingConstructorName";
222-
oldOrNewBranch: DiffErrorCulprit;
223-
typeName: string;
224-
}
221+
tag: "missingConstructorName";
222+
oldOrNewBranch: DiffErrorCulprit;
223+
typeName: string;
224+
}
225225
| {
226-
tag: "nestedDeclAlias";
227-
oldOrNewBranch: DiffErrorCulprit;
228-
constructorName1: string;
229-
constructorName2: string;
230-
}
226+
tag: "nestedDeclAlias";
227+
oldOrNewBranch: DiffErrorCulprit;
228+
constructorName1: string;
229+
constructorName2: string;
230+
}
231+
| {
232+
tag: "strayConstructor";
233+
oldOrNewBranch: DiffErrorCulprit;
234+
constructorName: string;
235+
}
231236
| {
232-
tag: "strayConstructor";
233-
oldOrNewBranch: DiffErrorCulprit;
234-
constructorName: string;
235-
};
237+
tag: "libFoundAtUnexpectedPath";
238+
path: string;
239+
};
236240

237241
type ContributionDiffConfig =
238242
| { tag: "ok" }

0 commit comments

Comments
 (0)