Skip to content

Commit

Permalink
Merge pull request #31 from Chaphasilor/dev
Browse files Browse the repository at this point in the history
Added additional error logging
  • Loading branch information
Chaphasilor authored Sep 15, 2022
2 parents e5cb6bf + 6ea0ee2 commit 2d6c7aa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ indexer.scanUrl(url)
| Wrapper Version | Supported ODD Versions (up to) | Included Version |
| --- | --- | --- |
| **9.0.0** | **v2.4.4.3+** | **v2.4.4.3** |
| **9.0.1** | **v2.4.4.3+** | **v2.4.4.3** |
| 9.0.0 | v2.4.4.3+ | v2.4.4.3 |
| 8.0.2 | v2.4.4.3+** | v2.4.4.1 |
| 8.0.0 | v2.4.4.3+ | v2.3.1.4 |
| 7.0.0 | 2.2.0.1-2.2.0.2 | 2.2.0.2 |
Expand Down
10 changes: 5 additions & 5 deletions open-directory-downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ module.exports.OpenDirectoryDownloader = class OpenDirectoryDownloader {
const finalResults = transcriber.output.split(`Saving URL list to file..`)[1];

if (!finalResults) {
return reject([new ODDWrapperError(`Failed to parse ODD output!`)])
return reject([new ODDWrapperError(`Failed to parse ODD output!`, `Transcriber Output:\n` + transcriber.output)])
}

// console.log(`finalResults:`, finalResults);
Expand All @@ -223,7 +223,7 @@ module.exports.OpenDirectoryDownloader = class OpenDirectoryDownloader {
const credits = transcriber.output.match(redditOutputEndRegExp)[0]

if (!redditOutputRegExp.test(finalResults)) {
return reject([new ODDWrapperError(`Failed to parse ODD output!`)])
return reject([new ODDWrapperError(`Failed to parse ODD output!`, `Transcriber Output:\n` + transcriber.output, `Final Results:\n` + finalResults)])
}
let redditOutput = `|**Url` + finalResults.match(redditOutputRegExp)[1]
.split('|**Url').filter(Boolean).slice(-1)[0] // make sure there's only a single table
Expand All @@ -232,13 +232,13 @@ module.exports.OpenDirectoryDownloader = class OpenDirectoryDownloader {

let sessionRegexResults = finalResults.match(/Saved\ session:\ (.*)/);
if (!sessionRegexResults || sessionRegexResults.length <= 1) {
return reject([new ODDWrapperError(`JSON session file not found!`)]);
return reject([new ODDWrapperError(`JSON session file not found!`, `Transcriber Output:\n` + transcriber.output)]);
}
let jsonFile = sessionRegexResults[1]; // get first capturing group. /g modifier has to be missing!

let urlListRegexResults = finalResults.match(/Saved URL list to file:\ (.*)/);
if (!urlListRegexResults || urlListRegexResults.length <= 1) {
return reject([new ODDWrapperError(`URL list file not found!`)]);
return reject([new ODDWrapperError(`URL list file not found!`, `Transcriber Output:\n` + transcriber.output)]);
}
let urlFile = urlListRegexResults[1];
if (!options.keepUrlFile) {
Expand Down Expand Up @@ -281,7 +281,7 @@ module.exports.OpenDirectoryDownloader = class OpenDirectoryDownloader {

// console.error(`Error while reading in the scan results:`, err);
reject([
new ODDWrapperError(`Error while reading in the scan results`),
new ODDWrapperError(`Error while reading in the scan results`, err.toString()),
response,
])

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-directory-downloader",
"version": "9.0.0",
"version": "9.0.1",
"description": "A NodeJS wrapper around KoalaBear84/OpenDirectoryDownloader",
"main": "open-directory-downloader.js",
"scripts": {
Expand Down

0 comments on commit 2d6c7aa

Please sign in to comment.