Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/mindsDb/node_modules/mindsdb-js-sdk/dist/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.MindsDbError = void 0;
var axios_1 = require("axios");
/** An error that occurs at the MindsDB level (e.g. API request, query execution). */
var MindsDbError = /** @class */ (function (_super) {
__extends(MindsDbError, _super);
/**
*
* @param {string} message - Message to associate with the error.
*/
function MindsDbError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
// See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
// for why this is needed.
Object.setPrototypeOf(_this, _newTarget.prototype);
// Maintains proper stack trace for where our error was thrown (only available on V8).
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
if (Error.captureStackTrace) {
Error.captureStackTrace(_this, MindsDbError);
}
_this.name = 'MindsDbError';
return _this;
}
MindsDbError.getBaseAxiosErrorMessage = function (axiosError) {
var _a;
return "Request failed with status code ".concat((_a = axiosError.response) === null || _a === void 0 ? void 0 : _a.status, ". ");
};
/**
* Creates a MindsDB error from an AxiosError, with a more readable error message.
* @param {AxiosError} axiosError - Original Axios Error
* @returns {MindsDbError} - New MindsDB error.
*/
MindsDbError.fromAxiosError = function (axiosError) {
var baseMsg = MindsDbError.getBaseAxiosErrorMessage(axiosError);
if (axiosError.response) {
// Request was made and server responded with non-2xx status code.
switch (axiosError.response.status) {
case axios_1.HttpStatusCode.BadRequest:
return new MindsDbError("".concat(baseMsg, " MindsDB received an invalid request and can't process it."));
case axios_1.HttpStatusCode.Unauthorized:
return new MindsDbError("".concat(baseMsg, " Did you provide the right username and password to the 'connect' method before using the SDK?"));
case axios_1.HttpStatusCode.Forbidden:
return new MindsDbError("".concat(baseMsg, " You don't have permission to access this resource. Did you provide the right username and password to the 'connect' method before using the SDK?"));
case axios_1.HttpStatusCode.NotFound:
return new MindsDbError("".concat(baseMsg, " This MindsDB resource doesn't exist."));
case axios_1.HttpStatusCode.TooManyRequests:
return new MindsDbError("".concat(baseMsg, " The number of requests you sent has exceeded the MindsDB API limit. Please contact us to request a limit increase."));
case axios_1.HttpStatusCode.RequestTimeout:
case axios_1.HttpStatusCode.GatewayTimeout:
return new MindsDbError("".concat(baseMsg, " The request took too long to complete. Please try again."));
case axios_1.HttpStatusCode.InternalServerError:
case axios_1.HttpStatusCode.BadGateway:
case axios_1.HttpStatusCode.ServiceUnavailable:
return new MindsDbError("".concat(baseMsg, " Oops! Something went wrong on our end. Please try again."));
default:
return new MindsDbError("".concat(baseMsg, " Full message: ").concat(axiosError.message));
}
}
else if (axiosError.request) {
// Request was made but no response was received.
return new MindsDbError("The request was made but no response was received. Something may be wrong on our end. Please try again.");
}
return new MindsDbError(axiosError.message);
};
/**
* Creates a MindsDB error from an error thrown during an HTTP request, with a more readable error message.
* @param {AxiosError} axiosError - Original HTTP Error
* @returns {MindsDbError} - New MindsDB error.
*/
MindsDbError.fromHttpError = function (error, url) {
if (error instanceof axios_1.AxiosError) {
return MindsDbError.fromAxiosError(error);
}
return new MindsDbError("Something went wrong handling HTTP POST request to ".concat(url, ": ").concat(error));
};
return MindsDbError;
}(Error));
exports.MindsDbError = MindsDbError;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0044 ]-- |