Skip to content

Commit 10ac55e

Browse files
authored
adds object of useful error when widget fails to render (#5141)
* adds object of useful error when widget fails to render
1 parent f89c55c commit 10ac55e

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
* `@apostrophecms/migration:requirements` handler now runs the migration requirements like `insertIfMissing`, `implementParkAllInDefaultLocale`, `replicate` and `implementParkAllInOtherLocales`.
1616
* Bump nodemailer to v7.x.
17+
* Improves client error log when unable to render a widget.
1718

1819
### Fixes
1920

‎modules/@apostrophecms/widget-type/ui/apos/composables/AposWidget.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,15 @@ export async function _renderContent(props) {
8080
}
8181
return {};
8282
} catch (e) {
83+
const errData = {
84+
widgetTitle: widget.title,
85+
widgetType: props.type,
86+
documentId: props.docId,
87+
errors: e.body?.data?.errors || []
88+
};
89+
8390
// eslint-disable-next-line no-console
84-
console.error('Unable to render widget. Possibly the schema has been changed and the existing widget does not pass validation.', e);
91+
console.error('Unable to render widget', errData, e);
8592
return {
8693
data: '<p>Unable to render this widget.</p>',
8794
error: true

0 commit comments

Comments
 (0)