Skip to content

Commit

Permalink
Use console.warn for error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
graphieros committed Mar 28, 2024
1 parent 2f8f4c4 commit 5f3e5b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-data-ui",
"private": false,
"version": "2.0.42",
"version": "2.0.43",
"type": "module",
"description": "A user-empowering data visualization Vue components library",
"keywords": [
Expand Down
9 changes: 7 additions & 2 deletions src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,13 @@ export function objectIsEmpty(obj) {
return Object.keys(obj).length === 0
}

export function error({ componentName, type, property='', index='', key='' }) {
throw new Error(`\n\n> ${errors[type].replace('#COMP#', componentName).replace('#ATTR#', property).replace('#INDX#', index).replace('#KEY#', key)}\n`)
export function error({ componentName, type, property='', index='', key='', warn = true }) {
const message = `\n> ${errors[type].replace('#COMP#', componentName).replace('#ATTR#', property).replace('#INDX#', index).replace('#KEY#', key)}\n`;
if (warn) {
console.warn(message)
} else {
throw new Error(message)
}
}

const lib = {
Expand Down

0 comments on commit 5f3e5b9

Please sign in to comment.