include node_modules so release .zip is deployable
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { InvalidArgument } from "../../exception/InvalidArgument";
|
||||
import { OutOfRange } from "../../exception/OutOfRange";
|
||||
export declare namespace ErrorGenerator {
|
||||
function get_class_name(instance: string | Instance): string;
|
||||
function empty(instance: Instance, method: string): OutOfRange;
|
||||
function negative_index(instance: Instance, method: string, index: number): OutOfRange;
|
||||
function excessive_index(instance: Instance, method: string, index: number, size: number): OutOfRange;
|
||||
function not_my_iterator(instance: Instance, method: string): InvalidArgument;
|
||||
function erased_iterator(instance: Instance, method: string): InvalidArgument;
|
||||
function negative_iterator(instance: Instance, method: string, index: number): OutOfRange;
|
||||
function iterator_end_value(instance: Instance, method?: string): OutOfRange;
|
||||
function key_nout_found<Key>(instance: Instance, method: string, key: Key): OutOfRange;
|
||||
}
|
||||
interface Instance {
|
||||
constructor: {
|
||||
name: string;
|
||||
__MODULE?: string;
|
||||
};
|
||||
}
|
||||
export {};
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ErrorGenerator = void 0;
|
||||
//================================================================
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
//================================================================
|
||||
var InvalidArgument_1 = require("../../exception/InvalidArgument");
|
||||
var OutOfRange_1 = require("../../exception/OutOfRange");
|
||||
var ErrorGenerator;
|
||||
(function (ErrorGenerator) {
|
||||
/* ---------------------------------------------------------
|
||||
COMMON
|
||||
--------------------------------------------------------- */
|
||||
function get_class_name(instance) {
|
||||
if (typeof instance === "string")
|
||||
return instance;
|
||||
var ret = instance.constructor.name;
|
||||
if (instance.constructor.__MODULE)
|
||||
ret = "".concat(instance.constructor.__MODULE, ".").concat(ret);
|
||||
return "std.".concat(ret);
|
||||
}
|
||||
ErrorGenerator.get_class_name = get_class_name;
|
||||
/* ---------------------------------------------------------
|
||||
CONTAINERS
|
||||
--------------------------------------------------------- */
|
||||
function empty(instance, method) {
|
||||
return new OutOfRange_1.OutOfRange("Error on ".concat(get_class_name(instance), ".").concat(method, "(): it's empty container."));
|
||||
}
|
||||
ErrorGenerator.empty = empty;
|
||||
function negative_index(instance, method, index) {
|
||||
return new OutOfRange_1.OutOfRange("Error on ".concat(get_class_name(instance), ".").concat(method, "(): parametric index is negative -> (index = ").concat(index, ")."));
|
||||
}
|
||||
ErrorGenerator.negative_index = negative_index;
|
||||
function excessive_index(instance, method, index, size) {
|
||||
return new OutOfRange_1.OutOfRange("Error on ".concat(get_class_name(instance), ".").concat(method, "(): parametric index is equal or greater than size -> (index = ").concat(index, ", size: ").concat(size, ")."));
|
||||
}
|
||||
ErrorGenerator.excessive_index = excessive_index;
|
||||
function not_my_iterator(instance, method) {
|
||||
return new InvalidArgument_1.InvalidArgument("Error on ".concat(get_class_name(instance), ".").concat(method, "(): parametric iterator is not this container's own."));
|
||||
}
|
||||
ErrorGenerator.not_my_iterator = not_my_iterator;
|
||||
function erased_iterator(instance, method) {
|
||||
return new InvalidArgument_1.InvalidArgument("Error on ".concat(get_class_name(instance), ".").concat(method, "(): parametric iterator, it already has been erased."));
|
||||
}
|
||||
ErrorGenerator.erased_iterator = erased_iterator;
|
||||
function negative_iterator(instance, method, index) {
|
||||
return new OutOfRange_1.OutOfRange("Error on ".concat(get_class_name(instance), ".").concat(method, "(): parametric iterator is directing negative position -> (index = ").concat(index, ")."));
|
||||
}
|
||||
ErrorGenerator.negative_iterator = negative_iterator;
|
||||
function iterator_end_value(instance, method) {
|
||||
if (method === void 0) { method = "end"; }
|
||||
var className = get_class_name(instance);
|
||||
return new OutOfRange_1.OutOfRange("Error on ".concat(className, ".Iterator.value: cannot access to the ").concat(className, ".").concat(method, "().value."));
|
||||
}
|
||||
ErrorGenerator.iterator_end_value = iterator_end_value;
|
||||
function key_nout_found(instance, method, key) {
|
||||
throw new OutOfRange_1.OutOfRange("Error on ".concat(get_class_name(instance), ".").concat(method, "(): unable to find the matched key -> ").concat(key));
|
||||
}
|
||||
ErrorGenerator.key_nout_found = key_nout_found;
|
||||
})(ErrorGenerator = exports.ErrorGenerator || (exports.ErrorGenerator = {}));
|
||||
//# sourceMappingURL=ErrorGenerator.js.map
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.internal
|
||||
*/
|
||||
import { ErrorCategory } from "../../exception/ErrorCategory";
|
||||
/**
|
||||
* Base class for error instances.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export declare abstract class ErrorInstance {
|
||||
protected category_: ErrorCategory;
|
||||
protected value_: number;
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Initializer Constructor.
|
||||
*
|
||||
* @param val Identifier of an error instance.
|
||||
* @param category An error category instance.
|
||||
*/
|
||||
constructor(val: number, category: ErrorCategory);
|
||||
/**
|
||||
* Assign content.
|
||||
*
|
||||
* @param val Identifier of an error condition.
|
||||
* @param category An error category instance.
|
||||
*/
|
||||
assign(val: number, category: ErrorCategory): void;
|
||||
/**
|
||||
* Clear content.
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Get category.
|
||||
*
|
||||
* @return The category object.
|
||||
*/
|
||||
category(): ErrorCategory;
|
||||
/**
|
||||
* Get value, the identifier.
|
||||
*
|
||||
* @return The value, identifier of this object.
|
||||
*/
|
||||
value(): number;
|
||||
/**
|
||||
* Get message.
|
||||
*
|
||||
* @return The message.
|
||||
*/
|
||||
message(): string;
|
||||
/**
|
||||
* Covert bo bool.
|
||||
*
|
||||
* @return Whether the {@link value} is not zero.
|
||||
*/
|
||||
to_bool(): boolean;
|
||||
toJSON(): object;
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ErrorInstance = void 0;
|
||||
/**
|
||||
* Base class for error instances.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
var ErrorInstance = /** @class */ (function () {
|
||||
function ErrorInstance(val, category) {
|
||||
if (val === void 0) { val = 0; }
|
||||
if (category === void 0) { category = null; }
|
||||
this.assign(val, category);
|
||||
}
|
||||
/**
|
||||
* Assign content.
|
||||
*
|
||||
* @param val Identifier of an error condition.
|
||||
* @param category An error category instance.
|
||||
*/
|
||||
ErrorInstance.prototype.assign = function (val, category) {
|
||||
this.category_ = category;
|
||||
this.value_ = val;
|
||||
};
|
||||
/**
|
||||
* Clear content.
|
||||
*/
|
||||
ErrorInstance.prototype.clear = function () {
|
||||
this.value_ = 0;
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
ACCESSORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* Get category.
|
||||
*
|
||||
* @return The category object.
|
||||
*/
|
||||
ErrorInstance.prototype.category = function () {
|
||||
return this.category_;
|
||||
};
|
||||
/**
|
||||
* Get value, the identifier.
|
||||
*
|
||||
* @return The value, identifier of this object.
|
||||
*/
|
||||
ErrorInstance.prototype.value = function () {
|
||||
return this.value_;
|
||||
};
|
||||
/**
|
||||
* Get message.
|
||||
*
|
||||
* @return The message.
|
||||
*/
|
||||
ErrorInstance.prototype.message = function () {
|
||||
return this.category_.message(this.value_);
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
OPERATORS
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* Covert bo bool.
|
||||
*
|
||||
* @return Whether the {@link value} is not zero.
|
||||
*/
|
||||
ErrorInstance.prototype.to_bool = function () {
|
||||
return this.value_ !== 0;
|
||||
};
|
||||
ErrorInstance.prototype.toJSON = function () {
|
||||
if (this.category_ === null)
|
||||
return {};
|
||||
else
|
||||
return {
|
||||
cateogory: this.category_.name(),
|
||||
value: this.value(),
|
||||
message: this.message(),
|
||||
};
|
||||
};
|
||||
return ErrorInstance;
|
||||
}());
|
||||
exports.ErrorInstance = ErrorInstance;
|
||||
//# sourceMappingURL=ErrorInstance.js.map
|
||||
Reference in New Issue
Block a user