Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
handle EAI_AGAIN in parse axios error and set proper defaults in lnd …
Browse files Browse the repository at this point in the history
…polar which should not load env vars
  • Loading branch information
ildella committed Aug 2, 2023
1 parent 6140623 commit 9c38df1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion axios/safe-http-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const safeHttpClient = (client, params) => {
response => response,
error => {
const parsed = parseAxiosError(error)
// console.log(error.response.data)
return Promise.reject(parsed)
}
)
Expand Down
5 changes: 5 additions & 0 deletions errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const parseAxiosError = error => {
message: 'Timed out.',
...basic,
}
if (code === 'EAI_AGAIN') return {
code,
message: error.message,
...basic,
}
if (!error.response) return {
status, code, message: 'HTTP error with no `response` property.', ...basic,
}
Expand Down
4 changes: 2 additions & 2 deletions fusto/websocket-stream-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module.exports = socket => (push, next) => {
push(new Error(error.message, {cause: error}))
})

socket.addEventListener('close', () => {
// console.info('socket close:')
socket.on('close', event => {
console.info('socket close event', event)

Check warning on line 18 in fusto/websocket-stream-source.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Unexpected console statement

Check warning on line 18 in fusto/websocket-stream-source.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Unexpected console statement
push(null, nil)
})
}
4 changes: 2 additions & 2 deletions lnd/lnd-polar-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const {curry} = require('../fusto')
const polarBasePath = networkNumber => `${homedir()}/.polar/networks/${networkNumber}/volumes/lnd/`

module.exports = curry((polarNetwork, {
host = process.env.LND_HOST,
port = process.env.LND_PORT,
host = 'localhost',
port = '8081',
username,
macaroonType = 'readonly',
}) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moar-js",
"version": "0.3.3",
"version": "0.3.4",
"description": "Simple JavaScript files I use across projects",
"license": "MIT",
"author": {
Expand Down
4 changes: 2 additions & 2 deletions tests/lnd/lnd-clients.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test('just checking...', () => {
expect(lndClients).toBeDefined()
})

test('http lnd client', () => {
const {lndHttp} = lndClients({baseUrl})
test.skip('http lnd client', () => {

Check warning on line 7 in tests/lnd/lnd-clients.test.js

View workflow job for this annotation

GitHub Actions / test (18.x)

Disabled test

Check warning on line 7 in tests/lnd/lnd-clients.test.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Disabled test
const {lndHttp} = lndClients()
expect(lndHttp).toBeDefined()
})

0 comments on commit 9c38df1

Please sign in to comment.