refactor(desktop): use Effect.orElseSucceed for WSL probe fallbacks
Align the four list/path/IP/home probe fallbacks with the convention upstream adopted in #2968: replace Effect.catch(() => Effect.succeed(x)) with the more direct Effect.orElseSucceed(() => x). Behavior is identical (recover from the error channel with a default); silences the new catchToOrElseSucceed lint.
This commit is contained in:
1 parent
3ca0696b95
commit
bd82399cca
1 file changed
+4
-4
@@ -327,7 +327,7 @@ const listDistrosImpl: Effect.Effect<
|
||||
).pipe(
|
||||
Effect.timeoutOption(LIST_TIMEOUT),
|
||||
Effect.map(Option.getOrElse((): readonly WslDistro[] => [])),
|
||||
Effect.catch(() => Effect.succeed<readonly WslDistro[]>([])),
|
||||
Effect.orElseSucceed((): readonly WslDistro[] => []),
|
||||
);
|
||||
|
||||
const preWarmImpl = (
|
||||
@@ -382,7 +382,7 @@ const windowsToWslPathImpl = (
|
||||
).pipe(
|
||||
Effect.timeoutOption(WSLPATH_TIMEOUT),
|
||||
Effect.map(Option.flatten),
|
||||
Effect.catch(() => Effect.succeed(Option.none<string>())),
|
||||
Effect.orElseSucceed(() => Option.none<string>()),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -420,7 +420,7 @@ const getDistroIpImpl = (
|
||||
).pipe(
|
||||
Effect.timeoutOption(USER_HOME_TIMEOUT),
|
||||
Effect.map(Option.flatten),
|
||||
Effect.catch(() => Effect.succeed(Option.none<string>())),
|
||||
Effect.orElseSucceed(() => Option.none<string>()),
|
||||
);
|
||||
|
||||
const getUserHomeImpl = (
|
||||
@@ -458,7 +458,7 @@ const getUserHomeImpl = (
|
||||
).pipe(
|
||||
Effect.timeoutOption(USER_HOME_TIMEOUT),
|
||||
Effect.map(Option.flatten),
|
||||
Effect.catch(() => Effect.succeed(Option.none<string>())),
|
||||
Effect.orElseSucceed(() => Option.none<string>()),
|
||||
);
|
||||
|
||||
const makeIsAvailable = (
|
||||
|
||||
Reference in new issue
Block a user