dijs / wiki

Wikipedia Interface for Node.js
MIT License
315 stars 61 forks source link

Invalid attempt to destructure non-iterable instance #115

Closed wcchh closed 5 years ago

wcchh commented 5 years ago

Invalid attempt to destructure non-iterable instance

As term is "林淑如"

let wiki = require('wikijs').default;
let term = "林淑如";
let apiUrl = "https://zh.wikipedia.org/w/api.php" ;
let page = await wiki({ 'apiUrl': apiUrl }).page(term);
let page_info, page_rawInfo
try {
  page_info = await page.info(); 
} catch(err) {
  console.log("[term]", term, "\n[ignore]", err.message)
}

Then the error I got with err.message: Invalid attempt to destructure non-iterable instance.

dijs commented 5 years ago

Good catch. Thanks for the code example, it really helped debug the issue.

This should be fixed in wikijs@5.1.1