Skip to content

Diff: show path on LibFoundAtUnexpectedPath error #92

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/UnisonShare/BranchDiffState.elm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type DiffError
, constructorName2 : FQN
}
| StrayConstructor { culprit : DiffErrorCulprit, constructorName : FQN }
| LibFoundAtUnexpectedPath
| LibFoundAtUnexpectedPath { path : FQN }
| UnknownError


Expand Down Expand Up @@ -74,6 +74,10 @@ decodeDiffError =
makeStrayConstructor culprit ctor =
StrayConstructor
{ culprit = culprit, constructorName = ctor }

makeLibFoundAtUnexpectedPath path =
LibFoundAtUnexpectedPath
{ path = path }
in
Decode.oneOf
[ whenTagIs "impossibleError"
Expand Down Expand Up @@ -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
]

Expand Down
5 changes: 3 additions & 2 deletions src/UnisonShare/Page/ProjectContributionChangesPage.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

_ ->
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/TestHelpers/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ type DiffErrorDetails =
tag: "strayConstructor";
oldOrNewBranch: DiffErrorCulprit;
constructorName: string;
}
| {
tag: "libFoundAtUnexpectedPath";
path: string;
};

type ContributionDiffConfig =
Expand Down
Loading