stellar-plus
Version:
beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain
48 lines (47 loc) • 2.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.VCRPCError = exports.ValidationCloudRpcHandlerErrorCodes = void 0;
const error_1 = require("../../../stellar-plus/error");
var ValidationCloudRpcHandlerErrorCodes;
(function (ValidationCloudRpcHandlerErrorCodes) {
// VCRPC0 General
ValidationCloudRpcHandlerErrorCodes["VCRPC001"] = "VCRPC001";
ValidationCloudRpcHandlerErrorCodes["VCRPC002"] = "VCRPC002";
ValidationCloudRpcHandlerErrorCodes["VCRPC003"] = "VCRPC003";
})(ValidationCloudRpcHandlerErrorCodes || (exports.ValidationCloudRpcHandlerErrorCodes = ValidationCloudRpcHandlerErrorCodes = {}));
const invalidApiKey = () => {
return new error_1.StellarPlusError({
code: ValidationCloudRpcHandlerErrorCodes.VCRPC001,
message: 'Invalid API key!',
source: 'ValidationCloudRpcHandler',
details: `Invalid API key! The provided API key is invalid! Make sure to generate a valid API key on the validationcloud.io website and use it to initialize the ValidationCloudRpcHandler.`,
});
};
const failedToInvokeVCApi = (error, payload) => {
return new error_1.StellarPlusError({
code: ValidationCloudRpcHandlerErrorCodes.VCRPC002,
message: 'Failed to invoke Validation Cloud API!',
source: 'ValidationCloudRpcHandler',
details: `Failed to invoke Validation Cloud API! A problem occurred while invoking the Validation Cloud API! Check the meta property for more details.`,
meta: {
error,
data: { payload },
},
});
};
const ledgerEntriesMissingFromRpcResponse = (response) => {
return new error_1.StellarPlusError({
code: ValidationCloudRpcHandlerErrorCodes.VCRPC003,
message: 'Ledger entries missing from RPC response!',
source: 'ValidationCloudRpcHandler',
details: `Ledger entries missing from RPC response! Please verify the meta details for the response!`,
meta: {
data: { response },
},
});
};
exports.VCRPCError = {
invalidApiKey,
failedToInvokeVCApi,
ledgerEntriesMissingFromRpcResponse,
};