import { ServerMethodName, ServerMethodParameters, ServerMethodReturn } from '../../contexts/ServerContext'; import { call } from './call'; import { handleError } from './handleError'; export const callWithErrorHandling = async ( method: M, ...params: ServerMethodParameters ): Promise> => { try { return await call(method, ...params); } catch (error) { handleError(error); throw error; } };