fix: Remove empty catch blocks and add error logging
This commit is contained in:
@@ -189,7 +189,9 @@ export const Terminal = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
terminal as { refresh?: (start: number, end: number) => void }
|
||||
).refresh(0, terminal.rows - 1);
|
||||
}
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
console.error("Terminal operation failed:", error);
|
||||
}
|
||||
}
|
||||
|
||||
function performFit() {
|
||||
@@ -331,7 +333,9 @@ export const Terminal = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
scheduleNotify(cols, rows);
|
||||
hardRefresh();
|
||||
}
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
console.error("Terminal operation failed:", error);
|
||||
}
|
||||
},
|
||||
refresh: () => hardRefresh(),
|
||||
}),
|
||||
@@ -738,7 +742,9 @@ export const Terminal = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
await navigator.clipboard.writeText(text);
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
console.error("Terminal operation failed:", error);
|
||||
}
|
||||
const textarea = document.createElement("textarea");
|
||||
textarea.value = text;
|
||||
textarea.style.position = "fixed";
|
||||
@@ -758,7 +764,9 @@ export const Terminal = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
if (navigator.clipboard && navigator.clipboard.readText) {
|
||||
return await navigator.clipboard.readText();
|
||||
}
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
console.error("Terminal operation failed:", error);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -855,7 +863,9 @@ export const Terminal = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
const pasteText = await readTextFromClipboard();
|
||||
if (pasteText) terminal.paste(pasteText);
|
||||
}
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
console.error("Terminal operation failed:", error);
|
||||
}
|
||||
};
|
||||
element?.addEventListener("contextmenu", handleContextMenu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user