function parseResponse(response) {
  let text;

  if (response && response.content && (typeof response.content === 'string')) {
    text = response.content;
  }

  if (response && response.text && (typeof response.text === 'string')) {
    text = response.text;
  }

  try {
    const parsedResponse = JSON.parse(text);

    if (
      parsedResponse
      && parsedResponse.data
      && (parsedResponse.data instanceof Object === true)
    ) {
      return parsedResponse.data;
    }
  } catch (err) {
    console.warn('Error while parsing JSON', err);
  }

  return {};
}

export default parseResponse;

@@ -505,20 +505,23 @@
     
-console.warn
+throw new Error
 ('Er
@@ -562,17 +562,51 @@
 %0A%0A  
-return %7B%7D
+throw new Error('Error while parsing JSON')
 ;%0A%7D%0A

Throw error instead of logging.