( name: K, ...args: Parameters<Operations[K]> )
| 1 | import {OperationName, Operations} from "src/domain/messages" |
| 2 | |
| 3 | export function invoke<K extends OperationName>( |
| 4 | name: K, |
| 5 | ...args: Parameters<Operations[K]> |
| 6 | ): Promise<Awaited<ReturnType<Operations[K]>>> { |
| 7 | return global.zui.invoke(name, ...args).catch((error) => { |
| 8 | throw new Error( |
| 9 | error |
| 10 | .toString() |
| 11 | // Here we are stripping the error prefix that electron tacks on. |
| 12 | .replace(`Error: Error invoking remote method '${name}': `, "") |
| 13 | ) |
| 14 | }) |
| 15 | } |
no test coverage detected