paper-hn
paper-hn copied to clipboard
Gracefully handle errors when updating items
Your instance seems to need a kick. Hasn't updated since Tuesday 2nd Nov 2021.
I quite like your way of presenting the best of what's on HN. Thanks for making it available!
Possibly caused by the same exception I'm seeing when running it locally caused by a 403 response code.
(node:41430) UnhandledPromiseRejectionWarning: Error: HTTP error: 403 for https://www.sec.gov/Archives/edgar/data/1720671/000119312521319849/d205906ds1.htm
at gethtml (file:///Users/rumbles5p/dev/paper-hn/lib/page-extract.mjs:23:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async page_info (file:///Users/rumbles5p/dev/paper-hn/lib/page-extract.mjs:131:25)
at async file:///Users/rumbles5p/dev/paper-hn/bin/generate-html.mjs:27:17
(Use `node --trace-warnings ...` to show where the warning was created)
(node:41430) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:41430) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(base) WS230327:paper-hn rumbles5p$ node ./bin/generate-html.mjs
(node:41443) UnhandledPromiseRejectionWarning: Error: HTTP error: 403 for https://www.sec.gov/Archives/edgar/data/1720671/000119312521319849/d205906ds1.htm
at gethtml (file:///Users/rumbles5p/dev/paper-hn/lib/page-extract.mjs:23:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async page_info (file:///Users/rumbles5p/dev/paper-hn/lib/page-extract.mjs:131:25)
at async file:///Users/rumbles5p/dev/paper-hn/bin/generate-html.mjs:27:17
(Use `node --trace-warnings ...` to show where the warning was created)
(node:41443) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:41443) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(base) WS230327:paper-hn rumbles5p$ node ./bin/generate-html.mjs
(node:41501) UnhandledPromiseRejectionWarning: Error: HTTP error: 403 for https://www.sec.gov/Archives/edgar/data/1720671/000119312521319849/d205906ds1.htm
at gethtml (file:///Users/rumbles5p/dev/paper-hn/lib/page-extract.mjs:23:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async page_info (file:///Users/rumbles5p/dev/paper-hn/lib/page-extract.mjs:131:25)
at async file:///Users/rumbles5p/dev/paper-hn/bin/generate-html.mjs:27:17
(Use `node --trace-warnings ...` to show where the warning was created)
(node:41501) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:41501) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Thanks for bringing this to my attention. Looks like it's working now, but this is an example of the general problem that the generator has no error handling; it should probably wrap each item in a try/catch in generate-html.mjs
and just drop the items that fail (or maybe have a smarter caching mechanism than the current one, which is "rm the folder and rebuild everything").
No idea when I'll get around to fixing this but PRs gladly accepted; like I said the quick fix I think is to just try{...} catch(e) {console.log(e)}
I quite like your way of presenting the best of what's on HN.
Yay! It's always nice to hear from users, I'm glad you find it useful.