@talak-web3/errors
v1.1.1
Published
Standardized error handling for talak-web3.
Downloads
39
Readme
@talak-web3/errors
Standardized error handling for talak-web3.
Installation
npm install @talak-web3/errors
yarn add @talak-web3/errors
pnpm add @talak-web3/errorsUsage
import { TalakError, AuthError, RpcError, ValidationError } from "@talak-web3/errors";
throw new AuthError("Invalid signature", {
code: "AUTH_INVALID_SIGNATURE",
statusCode: 401,
});
try {
await authenticate(message, signature);
} catch (error) {
if (error instanceof AuthError) {
console.log(error.code);
console.log(error.statusCode);
}
}Error Types
TalakError- Base error classAuthError- Authentication errorsRpcError- RPC/Blockchain errorsValidationError- Input validation errorsConfigError- Configuration errorsNetworkError- Network-related errors
License
MIT
