Ilshidur / can-iframe-url

Detect if an url can be included in an iframe by detecting the X-Frame-Options header with a HEAD request.

Home Page:https://npm.im/can-iframe-url

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About: Catch statement does not catch thrown error

mozgbrasil opened this issue · comments

Good afternoon my friends

I'm using your extension

But one of the URLs is being thrown error even using try / catch, as I do to suppress the error

Catch statement does not catch thrown error

Can you help me please

var url = 'https://www.w3schools.com/js/js_errors.asp'; // Ok
var url = 'http://objetosdeaprendizagem.com.br/como-a-historia-da-taxonomia-de-bloom-pode-me-ajudar-a-ensinar-melhor/'; // Z_BUF_ERROR

// console.log('url: ', url);

var includeAllowed = "failed";

try {
  var includeAllowed = await canIframeUrl(url);
} catch (err) {
  console.log("🔴️ err.message: ");
} finally {
  console.log("🔷️ try.finally");
}

console.log('includeAllowed: ', includeAllowed);

Captura de tela de 2019-10-29 18-09-38

Hello.

I just tried it on RunKit and I can't reproduce this.

Also, await canIframeUrl('http://objetosdeaprendizagem.com.br/como-a-historia-da-taxonomia-de-bloom-pode-me-ajudar-a-ensinar-melhor/') doesn't throw on my end and returns true.

Can you elaborate please ?

Good Morning

I just did the recommended test and the occurrence really has nothing to do with the extension

I'm sorry for anything