Skip to content

Commit

Permalink
Log more info when readWithPit catches
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Apr 8, 2024
1 parent ce4c245 commit a12f671
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export const readWithPit =
});
})
.catch((e) => {
console.log(e);
console.log(e.message);
console.log(JSON.stringify(e.meta));
console.log(JSON.stringify(e.body));
if (
e instanceof EsErrors.RequestAbortedError &&
/The content length \(\d+\) is bigger than the maximum/.test(e.message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,14 @@ describe('migration actions', () => {
maxResponseSizeBytes: 500, // set a small size to force the error
});
const rightResponse = (await readWithPitTask()) as Either.Right<ReadWithPit>;

await expect(Either.isRight(rightResponse)).toBe(true);
if (Either.isRight(rightResponse)) {
await expect(Either.isRight(rightResponse)).toBe(true);
} else {
console.log(
'got a left: ',
(rightResponse as Either.Left<EsResponseTooLargeError>).left.type
);
}

readWithPitTask = readWithPit({
client,
Expand Down

0 comments on commit a12f671

Please sign in to comment.