Skip to content

Commit

Permalink
More descriptive audit integration test errors (elastic#120354) (elas…
Browse files Browse the repository at this point in the history
…tic#120409)

Co-authored-by: Joe Portner <[email protected]>
  • Loading branch information
kibanamachine and jportner authored Dec 3, 2021
1 parent cea23b0 commit fdbdbef
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ class FileWrapper {
}
async readJSON() {
const content = await this.read();
return content.map((l) => JSON.parse(l));
try {
return content.map((l) => JSON.parse(l));
} catch (err) {
const contentString = content.join('\n');
throw new Error(
`Failed to parse audit log JSON, error: "${err.message}", audit.log contents:\n${contentString}`
);
}
}
// writing in a file is an async operation. we use this method to make sure logs have been written.
async isNotEmpty() {
Expand Down

0 comments on commit fdbdbef

Please sign in to comment.