Skip to content

Commit

Permalink
hod hasharon tree url fix (#753)
Browse files Browse the repository at this point in the history
* hod hasharon tree url fix

* better proxy failure logging
  • Loading branch information
yaelal authored Nov 28, 2023
1 parent b916636 commit 638b728
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/api/lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function get(url, wait =5000) {
return response.data;
}
catch (err) {
console.error(`error in proxy for url ${url}`);
console.error(`error in proxy for url ${url}`, err);
}
}
module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions server/api/lib/trees/hod_hasharon_tree_permit.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function parseTreesHtml(url) {
const treePermit = {};
dom(elem).find('td,th').each((idx, elem) => {
const url = idx === 6 ? dom(elem).find('a').attr('href') : '';
if (url.length > 0) {
if (url && url.length > 0) {
treePermit['url'] = url.substr(1);
}
const value = dom(elem).text().trim();
Expand Down Expand Up @@ -92,7 +92,7 @@ function processRawPermits(rawPermits) {
[TREES_PER_PERMIT]: treesPerPermit,
[TOTAL_TREES]: totalTrees,

[TREE_PERMIT_URL]: 'https://www.hod-hasharon.muni.il' + raw['url'],
[TREE_PERMIT_URL]: raw['url'] ? 'https://www.hod-hasharon.muni.il' + raw['url'] : '',
};
const permit = new TreePermit(attributes);
return permit;
Expand Down

0 comments on commit 638b728

Please sign in to comment.