Skip to content

Commit

Permalink
Cleanup request error
Browse files Browse the repository at this point in the history
  • Loading branch information
alejouribesanchez committed Oct 31, 2024
1 parent a7b9459 commit 3621c2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/client/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ Client.prototype._request = async function (http_verb, endpoint_name, request_ar
});
} catch (response) {
let errorStatus = response?.response?.status;
let errorInfo = response?.response?.data?.error;
let message = response?.message;
throw new Error(`Error: ${errorStatus} ${errorInfo} ${message}`);
let errorInfo = response?.response?.data;
throw new Error(`Error: ${errorStatus} ${JSON.stringify(errorInfo)}`);
}
}
4 changes: 2 additions & 2 deletions test/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const username = process.env.VERYFI_USERNAME;
const api_key = process.env.VERYFI_API_KEY;
const base_url = process.env.VERYFI_URL;
const timeout = 240000;
const mock_responses = true;
const mock_responses = false;

//Creating the Client
let veryfi_client = new Client(client_id, client_secret, username, api_key, base_url, 240);
let veryfi_client = new Client(client_id, client_secret, "username", api_key, base_url, 240);
jest.setTimeout(timeout);

describe('Processing documents', () => {
Expand Down

0 comments on commit 3621c2c

Please sign in to comment.