Skip to content

Commit

Permalink
catch wrong daemon error mapping workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
doums committed Jan 22, 2025
1 parent db86a19 commit 611b488
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nym-vpn-app/src/state/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ export async function initFirstBatch(
onFulfilled: ({ state, error }) => {
dispatch({ type: 'update-connection-state', state });
if (error) {
// TODO remove this dirty hack once switched to the new tunnel API
if (
error.key === 'CSDaemonInternal' &&
error.data?.reason.includes('SameEntryAndExitGateway')
) {
dispatch({
type: 'set-error',
error: {
key: 'CStateGwDirSameEntryAndExitGw',
message: 'Cannot connect to the same entry and exit gateway',
},
});
return;
}
dispatch({ type: 'set-error', error });
}
},
Expand Down
14 changes: 14 additions & 0 deletions nym-vpn-app/src/state/useTauriEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ function handleError(dispatch: StateDispatch, error?: BackendError | null) {
return;
}
console.log('received backend error:', error);
// TODO remove this dirty hack once switched to the new tunnel API
if (
error.key === 'CSDaemonInternal' &&
error.data?.reason.includes('SameEntryAndExitGateway')
) {
dispatch({
type: 'set-error',
error: {
key: 'CStateGwDirSameEntryAndExitGw',
message: 'Cannot connect to the same entry and exit gateway',
},
});
return;
}
dispatch({ type: 'set-error', error });
}

Expand Down

0 comments on commit 611b488

Please sign in to comment.