@kubiklabs/wasmkit
Version:
Wasmkit is a development environment to compile, deploy, test, run cosmwasm contracts on different networks.
60 lines (59 loc) • 2.51 kB
TypeScript
import { ErrorDescriptor } from './errors-list';
export declare class WasmkitError extends Error {
static isWasmkitError(other: any): other is WasmkitError;
static isWasmkitErrorType(other: any, // eslint-disable-line
descriptor: ErrorDescriptor): other is WasmkitError;
readonly errorDescriptor: ErrorDescriptor;
readonly number: number;
readonly messageArguments: Record<string, any>;
readonly parent?: Error;
private readonly _isWasmkitError;
constructor(errorDescriptor: ErrorDescriptor, messageArguments?: Record<string, any>, // eslint-disable-line @typescript-eslint/no-explicit-any
parentError?: Error);
}
/**
* This class is used to throw errors from WasmKit plugins made by third parties.
*/
export declare class WasmKitPluginError extends Error {
static isWasmKitPluginError(other: any): other is WasmKitPluginError;
readonly parent?: Error;
readonly pluginName: string;
private readonly _isWasmKitPluginError;
/**
* Creates a WasmKitPluginError.
*
* @param pluginName The name of the plugin.
* @param message An error message that will be shown to the user.
* @param parent The error that causes this error to be thrown.
*/
constructor(pluginName: string, message: string, parent?: Error);
/**
* A DEPRECATED constructor that automatically obtains the caller package and
* use it as plugin name.
*
* @deprecated Use the above constructor.
*
* @param message An error message that will be shown to the user.
* @param parent The error that causes this error to be thrown.
*/
constructor(message: string, parent?: Error);
}
/**
* This function applies error messages templates like this:
*
* - Template is a string which contains a variable tags. A variable tag is a
* a variable name surrounded by %. Eg: %plugin1%
* - A variable name is a string of alphanumeric ascii characters.
* - Every variable tag is replaced by its value.
* - %% is replaced by %.
* - Values can't contain variable tags.
* - If a variable is not present in the template, but present in the values
* object, an error is thrown.
*
* @param template The template string.
* @param values A map of variable names to their values.
*/
export declare function applyErrorMessageTemplate(template: string, values: {
[templateVar: string]: any;
}): string;
export declare function assertWasmKitInvariant(invariant: boolean, message: string): asserts invariant;