Skip to content

Commit

Permalink
Wrap getImageNode() in try/catch to handle CORS error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Q committed Jun 30, 2020
1 parent 756656e commit 1f6ffc7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/utils/hooks/use-color-extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ export function useColorExtract( {
};

const extractColor = () => {
const imageNode = getImageNode();
const isGetPalette = numberOfColors !== 1;

return new Promise( ( resolve, reject ) => {
try {
const imageNode = getImageNode();
const isGetPalette = numberOfColors !== 1;

imageNode.onload = () => {
let data;
let value;
Expand Down

0 comments on commit 1f6ffc7

Please sign in to comment.