Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Changes

* Bump nodemailer to v7.x.
* Improves client error log when unable to render a widget.

### Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ export async function _renderContent(props) {
}
return {};
} catch (e) {
const errData = {
widgetTitle: widget.title,
widgetType: props.type,
documentId: props.docId,
errors: e.body.data?.errors || []

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could name it fieldErrors maybe ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed it the first time. I don't think we can be absolutely sure that e.body will be an object. I'll do e.body?.data?.errors instead

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done.

};

// eslint-disable-next-line no-console
console.error('Unable to render widget. Possibly the schema has been changed and the existing widget does not pass validation.', e);
console.error('Unable to render widget', errData, e);
return {
data: '<p>Unable to render this widget.</p>',
error: true
Expand Down