import type { AsyncResult, ErrorLevel, Result } from '../../../mod.js'; import { AnyError } from '../../../mod.js'; /** ## AnyResult : 错误类型为 {@link AnyError} 的 {@link Result } @category Error */ export type AnyResult = Result>; /** ## AsyncAnyResult : 对 {@link AnyResult} 的异步封装 @category Error */ export type AsyncAnyResult = AsyncResult>; /** ## ## AnyErr : 一个快速创建AnyError的函数 @example ```ts const err = AnyErr('Error','test error') assert(err.type === 'Error')//Pass assert(err.cause === 'test error')//Pass assert(err.name === 'AnyError')//Pass ``` @category TypeClass */ export declare const AnyErr: (type: T, cause?: string, name?: string) => Result>; /** ## `panic` : 以函数的形式快速抛出一个AnyError类型的异常 + 通常搭配{@link result}使用,用于解决语句执行中不能随时返回AnyError的问题 @example ```ts assertThrow(panic('Error','test error'))//Pass try{ panic() }catch(e){// catch AnyError assert(e.type==='Panic')//Pass } ``` @category Error */ export declare function panic(type?: ErrorLevel, cause?: string, name?: string): never; /** ## `abort` : 以函数调用形式抛出异常 类似C语言的[abord](https://en.cppreference.com/w/c/program/abort)函数 `abort(x)` === `throw x` */ export declare function abort(any: any): never; //# sourceMappingURL=anyErrorHelper.d.ts.map