macoolka-error
Version:
`macoolka-cache` Build a cache for function
42 lines (41 loc) • 845 B
TypeScript
/**
* @file
*/
import { WarnMessage } from './types';
/**
* @since 0.2.0
*/
export interface IOProps<T = any> {
/**
* Message Title
* @desczh
* 消息标题
*/
title?: string;
/**
* Message Content
* @desczh
* 消息
*/
message: string;
/**
* sync function
* @desczh
* 同步函数
*/
io: (() => T);
}
/**
* Throw a Error with message when io throw exception
* @desczh
* 当io抛出异常时抛出错误
* @since 0.2.0
*/
export declare function runIO({ io, message, title }: IOProps): any;
/**
* Call warn and return a defualt value when io throw exception
* @desczh
* 当io抛出异常时返回缺省值并调用warn
* @since 0.2.0
*/
export declare function runIOWarn<T>({ title, io, message, defaultValue, warn }: WarnMessage<IOProps, T>): T;