Skip to content

Commit

Permalink
Show internal error instead of install link
Browse files Browse the repository at this point in the history
Summary: Also add cwd selector selector so you can change cwd if the first one doesn't exist.

Reviewed By: sggutier

Differential Revision: D57283355

fbshipit-source-id: 78b86214f3e0baf50a17fb08c364bf6fb18e7f10
  • Loading branch information
evangrayk authored and facebook-github-bot committed May 13, 2024
1 parent 580e9c3 commit 35cc4e8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
59 changes: 34 additions & 25 deletions addons/isl/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,31 +258,40 @@ function ISLNullState({repoError}: {repoError: RepositoryError}) {
}
} else if (repoError.type === 'cwdDoesNotExist') {
content = (
<ErrorNotice
title={
<T replace={{$cwd: repoError.cwd}}>
cwd $cwd does not exist. Make sure the folder exists.
</T>
}
error={
new Error(
t('$cwd not found', {
replace: {$cwd: repoError.cwd},
}),
)
}
buttons={[
<Button
key="help-button"
onClick={e => {
platform.openExternalLink('https://sapling-scm.com/docs/introduction/installation');
e.preventDefault();
e.stopPropagation();
}}>
<T>See installation docs</T>
</Button>,
]}
/>
<>
{Internal.InternalInstallationDocs ? (
<Internal.InternalInstallationDocs repoError={repoError} />
) : (
<ErrorNotice
title={
<T replace={{$cwd: repoError.cwd}}>
cwd $cwd does not exist. Make sure the folder exists.
</T>
}
error={
new Error(
t('$cwd not found', {
replace: {$cwd: repoError.cwd},
}),
)
}
buttons={[
<Button
key="help-button"
onClick={e => {
platform.openExternalLink(
'https://sapling-scm.com/docs/introduction/installation',
);
e.preventDefault();
e.stopPropagation();
}}>
<T>See installation docs</T>
</Button>,
]}
/>
)}
<CwdSelections dismiss={() => null} />
</>
);
} else if (repoError.type === 'invalidCommand') {
if (Internal.InvalidSlCommand) {
Expand Down
2 changes: 1 addition & 1 deletion addons/isl/src/CwdSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {ButtonDropdown} from './components/ButtonDropdown';
import {Divider} from './components/Divider';
import {RadioGroup} from './components/Radio';
import {T, t} from './i18n';
import {lazyAtom, writeAtom} from './jotaiUtils';
import {writeAtom} from './jotaiUtils';
import {serverCwd} from './repositoryData';
import {repositoryInfo} from './serverAPIState';
import {registerCleanup, registerDisposable} from './utils';
Expand Down

0 comments on commit 35cc4e8

Please sign in to comment.