Skip to content

Commit

Permalink
[chores] Improved errors, disabled no-console rule
Browse files Browse the repository at this point in the history
  • Loading branch information
totallynotvaishnav committed Nov 14, 2022
1 parent 3302b53 commit 4529b2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
rules: {
"no-param-reassign": "off",
"class-methods-use-this": "off",
"no-console": "off",
},
env: {
jest: true,
Expand Down
4 changes: 2 additions & 2 deletions src/js/netjsonWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ const operations = {
nodeLinks[sourceNode.id] += 1;
nodeLinks[targetNode.id] += 1;
} else if (!sourceNode) {
console.error(`Node ${link.source} is not exist!`);
console.error(`Node ${link.source} does not exist!`);
} else {
console.error(`Node ${link.target} is not exist!`);
console.error(`Node ${link.target} does not exist!`);
}
});
Object.keys(JSONData.flatNodes).forEach((nodeID) => {
Expand Down
10 changes: 4 additions & 6 deletions src/js/netjsongraph.render.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ class NetJSONGraphRender {
});
links.forEach((link) => {
if (!flatNodes[link.source]) {
console.warn(`Node ${link.source} is not exist!`);
console.warn(`Node ${link.source} does not exist!`);
} else if (!flatNodes[link.target]) {
console.warn(`Node ${link.target} is not exist!`);
console.warn(`Node ${link.target} does not exist!`);
} else {
const {linkStyleConfig, linkEmphasisConfig} = self.utils.getLinkStyle(
link,
Expand Down Expand Up @@ -312,8 +312,7 @@ class NetJSONGraphRender {
*/
mapRender(JSONData, self) {
if (!self.config.mapTileConfig[0]) {
console.error(`You must add the tiles via the "mapTileConfig" param!`);
return;
throw new Error(`You must add the tiles via the "mapTileConfig" param!`);
}

if (self.type === "netjson") {
Expand Down Expand Up @@ -637,8 +636,7 @@ class NetJSONGraphRender {
*/
appendData(JSONData, self) {
if (self.config.render !== self.utils.mapRender) {
console.error("AppendData function can only be used for map render!");
return;
throw new Error("AppendData function can only be used for map render!");
}

if (self.type === "netjson") {
Expand Down

0 comments on commit 4529b2c

Please sign in to comment.