mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-29 13:05:40 +00:00
1295c36241
- Fixed TypeScript type assertion issues - Updated imports from api-augment/substrate to api-augment/bizinikiwi - Fixed imgConvert.mjs header and imports - Added @ts-expect-error for runtime-converted types - Fixed all @polkadot copyright headers to @pezkuwi
14 lines
508 B
TypeScript
14 lines
508 B
TypeScript
// Copyright 2017-2025 @pezkuwi/react-hooks authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
export function createNamedHook <F extends (...args: any[]) => any> (name: string, fn: F): (...args: Parameters<F>) => ReturnType<F> {
|
|
return (...args: Parameters<F>): ReturnType<F> => {
|
|
try {
|
|
// eslint-disable-next-line
|
|
return fn(...args);
|
|
} catch (error) {
|
|
throw new Error(`${name}:: ${(error as Error).message}:: ${(error as Error).stack || '<unknown>'}`);
|
|
}
|
|
};
|
|
}
|