mirror of
https://github.com/karl0ss/homepage.git
synced 2025-07-03 14:39:08 +01:00
Use logger for validate widget errors
This commit is contained in:
parent
44f8e9d4da
commit
7b94ccb01f
@ -1,5 +1,8 @@
|
|||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import widgets from "widgets/widgets";
|
import widgets from "widgets/widgets";
|
||||||
|
import createLogger from "utils/logger";
|
||||||
|
|
||||||
|
const logger = createLogger("validateWidgetData");
|
||||||
|
|
||||||
export default function validateWidgetData(widget, endpoint, data) {
|
export default function validateWidgetData(widget, endpoint, data) {
|
||||||
let valid = true;
|
let valid = true;
|
||||||
@ -33,7 +36,7 @@ export default function validateWidgetData(widget, endpoint, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
console.warn(
|
logger.error(
|
||||||
`Invalid data for widget '${widget.type}' endpoint '${endpoint}':\nExpected:${mapping?.validate}\nParse error: ${
|
`Invalid data for widget '${widget.type}' endpoint '${endpoint}':\nExpected:${mapping?.validate}\nParse error: ${
|
||||||
error ?? "none"
|
error ?? "none"
|
||||||
}\nData: ${JSON.stringify(data)}`,
|
}\nData: ${JSON.stringify(data)}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user