Skip to content

Commit

Permalink
Replace the technical error message with a more user-friendly one (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel authored and youknowriad committed Jul 6, 2021
1 parent b1835be commit 49b45e1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/widgets/src/blocks/legacy-widget/edit/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import classnames from 'classnames';
import { useRef, useEffect } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { Popover } from '@wordpress/components';
import { useViewportMatch } from '@wordpress/compose';
/**
Expand Down Expand Up @@ -56,12 +56,16 @@ export default function Form( {
},
onChangeHasPreview,
onError( error ) {
window.console.error( error );
createNotice(
'error',
error?.message ??
sprintf(
/* translators: %s: the name of the affected block. */
__(
'An error occured while fetching or updating the widget.'
)
'The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'
),
idBase || id
)
);
},
} );
Expand Down

0 comments on commit 49b45e1

Please sign in to comment.