Undefined returning and errors
antiss11 opened this issue · 7 comments
The problem is null
returns in 2 cases: when error has place and no books in results. So there is no ways to separate errors and empty search results.
Ok, i was wrong - these 2 cases return undefined
.
I've got next code:
const flibustaApi = new FlibustaAPI(ORIGIN, { httpAgent });
const result = await flibustaApi.getBooksByNameFromOpds(bookTitle);
console.log(result);
And when I try to find book with title 12345
with active tor
(or any proxy) service result is undefined
.
After I stop tor
and try to run code, I've got next output:
First part - with tor
, second - without.
I think that the way you return errors isn't good. Ok, let it be, I'll try to do something later.
I think that the way you return errors isn't good. Ok, let it be, I'll try to do something later.
Yeah, i'll change that part soon. Wait for 0.4.1
!
Just released 0.4.1
.
Now on execution of code
const flibustaApi = new FlibustaAPI(ORIGIN, { httpAgent });
const result = await flibustaApi.getBooksByNameFromOpds(bookTitle);
console.log(result);
Should log an error
Works as intended. Good job!