improved port-forward error reporting (#4108)

* improved port-forward error reporting

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>

* satisfy lint and some autoformatting

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann authored and GitHub committed 2021-10-22 17:19:50 -04:00
1 parent 169f443c3b
commit bbfb8372f3
5 files changed
+52 -39

No files matched your search

@@ -26,6 +26,7 @@ import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
import { MenuItem } from "../menu";
import { Icon } from "../icon";
import { PortForwardDialog } from "../../port-forward";
import { Notifications } from "../notifications";
interface Props extends MenuActionsProps {
portForward: PortForwardItem;
@@ -35,7 +36,13 @@ interface Props extends MenuActionsProps {
export class PortForwardMenu extends React.Component<Props> {
@boundMethod
remove() {
return removePortForward(this.props.portForward);
const { portForward } = this.props;
try {
removePortForward(portForward);
} catch (error) {
Notifications.error(`Error occurred stopping the port-forward from port ${portForward.forwardPort}. The port-forward may still be active.`);
}
}
renderContent() {