ynhhoJ/flibusta-api

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.

@antiss11 , can you provide some examples?

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:
2022-09-15-193139_560x37_scrot

@antiss11 , can you please try again with version 0.4.0?

@ynhhoJ
2022-09-15-200527_773x136_scrot

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!