aboutsummaryrefslogtreecommitdiff
path: root/src/utils/misc.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/misc.tsx')
-rw-r--r--src/utils/misc.tsx28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx
index 0ef7ffb..c64d9e1 100644
--- a/src/utils/misc.tsx
+++ b/src/utils/misc.tsx
@@ -153,34 +153,6 @@ export function sleep(ms: number): Promise<void> {
}
/**
- * Wraps a Function into a try catch block and logs any errors caught
- * Due to the nature of this function, not all paths return a result.
- * Thus, for consistency, the returned functions will always return void or Promise<void>
- *
- * @param name Name identifying the wrapped function. This will appear in the logged errors
- * @param func Function (async or sync both work)
- * @param thisObject Optional thisObject
- * @returns Wrapped Function
- */
-export function suppressErrors<F extends Function>(name: string, func: F, thisObject?: any): F {
- return (func.constructor.name === "AsyncFunction"
- ? async function (this: any) {
- try {
- await func.apply(thisObject ?? this, arguments);
- } catch (e) {
- console.error(`Caught an Error in ${name || "anonymous"}\n`, e);
- }
- }
- : function (this: any) {
- try {
- func.apply(thisObject ?? this, arguments);
- } catch (e) {
- console.error(`Caught an Error in ${name || "anonymous"}\n`, e);
- }
- }) as any as F;
-}
-
-/**
* Wrap the text in ``` with an optional language
*/
export function makeCodeblock(text: string, language?: string) {