UNPKG

@hashgraph/hedera-local

Version:

Developer tooling for running Local Hedera Network (Consensus + Mirror Nodes).

53 lines 1.8 kB
"use strict"; // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.Errors = exports.LocalNodeErrors = void 0; /** * Class representing the local node errors. * @extends Error */ class LocalNodeErrors extends Error { /** * Create a local node error. * @param {string} name - The name of the error. * @param {string} message - The message of the error. */ constructor(name, message) { super(); this.name = name; this.message = message; } /** * Check if the error is a connection error. * @returns {boolean} True if the error is a connection error, false otherwise. */ IS_CONNECTION_ERROR() { return this.name == "Connection Error"; } /** * Check if the error is a client error. * @returns {boolean} True if the error is a client error, false otherwise. */ CLIENT_ERROR() { return this.name == "Client Error"; } } exports.LocalNodeErrors = LocalNodeErrors; /** * Object containing functions to create specific local node errors. */ exports.Errors = { /** * Create a connection error. * @param {number} [port] - The port number. * @returns {LocalNodeErrors} The connection error. */ CONNECTION_ERROR: (port) => new LocalNodeErrors("Connection Error", `Something went wrong, while trying to connect ${port ? `to port ${port}` : `to local node`}`), /** * Create a client error. * @param {string} [msg] - The error message. * @returns {LocalNodeErrors} The client error. */ CLEINT_ERROR: (msg) => new LocalNodeErrors("Client Error", `Something went wrong, while trying to create SDK Client${msg ? `: ${msg}` : ``}`), }; //# sourceMappingURL=LocalNodeErrors.js.map