Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@litert/core

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@litert/core - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

6

CHANGES.md
# Changes Logs
## v1.0.7
- Added `setCodeBase` method for `IErrorHub`.
- Now the counter of auto-increase code number will be overwritten by a bigger specific code number
while defining a new error.
## v1.0.6

@@ -4,0 +10,0 @@

@@ -178,2 +178,8 @@ /**

/**
* Set the base of error code number while defining an error with an omitted code number.
*
* @param codeBase The new base of error code number.
*/
setCodeBase(codeBase: number): this;
/**
* Get the error constructor by its name or code.

@@ -180,0 +186,0 @@ *

20

lib/Error.js

@@ -126,2 +126,6 @@ "use strict";

}
setCodeBase(codeBase) {
this._counter = codeBase;
return this;
}
get module() {

@@ -154,5 +158,11 @@ return this._module;

}
else {
this._counter = code;
if (this._errors[code]) {
const TheError = DEFAULT_HUB.get("DUPLICATED_ERROR_CODE");
throw new TheError({
message: `The code ${JSON.stringify(code)} of new error already exists.`
});
}
if (code > this._counter) {
this._counter = code + 1;
}
if (this._errors[name]) {

@@ -174,8 +184,2 @@ const TheError = DEFAULT_HUB.get("DUPLICATED_ERROR_NAME");

}
if (this._errors[code]) {
const TheError = DEFAULT_HUB.get("DUPLICATED_ERROR_CODE");
throw new TheError({
message: `The code ${JSON.stringify(code)} of new error already exists.`
});
}
if (aliasCodes.length) {

@@ -182,0 +186,0 @@ for (const alias of aliasCodes) {

2

package.json
{
"name": "@litert/core",
"version": "1.0.6",
"version": "1.0.7",
"description": "The core of LiteRT.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -351,2 +351,9 @@ /**

/**
* Set the base of error code number while defining an error with an omitted code number.
*
* @param codeBase The new base of error code number.
*/
setCodeBase(codeBase: number): this;
/**
* Get the error constructor by its name or code.

@@ -390,2 +397,9 @@ *

public setCodeBase(codeBase: number): this {
this._counter = codeBase;
return this;
}
public constructor(moduleName: string) {

@@ -464,7 +478,17 @@

}
else {
this._counter = code;
if (this._errors[code]) {
const TheError = DEFAULT_HUB.get("DUPLICATED_ERROR_CODE");
throw new TheError({
message: `The code ${JSON.stringify(code)} of new error already exists.`
});
}
if (code > this._counter) {
this._counter = code + 1;
}
if (this._errors[name]) {

@@ -494,11 +518,2 @@

if (this._errors[code]) {
const TheError = DEFAULT_HUB.get("DUPLICATED_ERROR_CODE");
throw new TheError({
message: `The code ${JSON.stringify(code)} of new error already exists.`
});
}
if (aliasCodes.length) {

@@ -505,0 +520,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc