Skip to content

Commit 323ae93

Browse files
committed
fix: satisfy lint rules
1 parent 632b24d commit 323ae93

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/factories/payments-processors/alby-nwc-payments-processor-factory.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
import { createSettings } from '../settings-factory'
22
import { AlbyNwcPaymentsProcessor } from '../../payments-processors/alby-nwc-payments-processor'
3+
import { createLogger } from '../logger-factory'
34
import { IPaymentsProcessor } from '../../@types/clients'
45
import { Settings } from '../../@types/settings'
56

7+
const debug = createLogger('alby-nwc-payments-processor-factory')
8+
69
const getAlbyNwcConfig = (settings: Settings): { nwcUrl: string; replyTimeoutMs: number } => {
710
const nwcUrl = process.env.ALBY_NWC_URL
811

912
if (!nwcUrl) {
1013
const error = new Error('ALBY_NWC_URL must be set.')
11-
console.error('Unable to create Alby NWC payments processor.', error)
14+
debug('Unable to create Alby NWC payments processor. %o', error)
1215
throw error
1316
}
1417

1518
if (!nwcUrl.startsWith('nostr+walletconnect://') && !nwcUrl.startsWith('nostrwalletconnect://')) {
1619
const error = new Error('ALBY_NWC_URL must be a valid nostr+walletconnect:// or nostrwalletconnect:// URI.')
17-
console.error('Unable to create Alby NWC payments processor.', error)
20+
debug('Unable to create Alby NWC payments processor. %o', error)
1821
throw error
1922
}
2023

2124
try {
2225
new URL(nwcUrl)
2326
} catch {
2427
const error = new Error('ALBY_NWC_URL is not parseable as a URL.')
25-
console.error('Unable to create Alby NWC payments processor.', error)
28+
debug('Unable to create Alby NWC payments processor. %o', error)
2629
throw error
2730
}
2831

2932
const replyTimeoutMs = settings.paymentsProcessors?.alby?.replyTimeoutMs
3033
if (typeof replyTimeoutMs !== 'number' || replyTimeoutMs <= 0) {
3134
const error = new Error('Setting paymentsProcessors.alby.replyTimeoutMs must be a positive number.')
32-
console.error('Unable to create Alby NWC payments processor.', error)
35+
debug('Unable to create Alby NWC payments processor. %o', error)
3336
throw error
3437
}
3538

src/payments-processors/alby-nwc-payments-processor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ export class AlbyNwcPaymentsProcessor implements IPaymentsProcessor {
140140
})
141141
} catch (error) {
142142
if (error instanceof nwc.Nip47WalletError || error instanceof nwc.Nip47ReplyTimeoutError) {
143-
console.error(`Unable to get Alby NWC invoice ${invoiceId}. Reason:`, error.message)
143+
debug('Unable to get Alby NWC invoice %s. Reason: %s', invoiceId, error.message)
144144
} else {
145-
console.error(`Unable to get Alby NWC invoice ${invoiceId}. Reason:`, error)
145+
debug('Unable to get Alby NWC invoice %s. Reason: %o', invoiceId, error)
146146
}
147147
throw error
148148
}
@@ -183,9 +183,9 @@ export class AlbyNwcPaymentsProcessor implements IPaymentsProcessor {
183183
})
184184
} catch (error) {
185185
if (error instanceof nwc.Nip47WalletError || error instanceof nwc.Nip47ReplyTimeoutError) {
186-
console.error('Unable to request Alby NWC invoice. Reason:', error.message)
186+
debug('Unable to request Alby NWC invoice. Reason: %s', error.message)
187187
} else {
188-
console.error('Unable to request Alby NWC invoice. Reason:', error)
188+
debug('Unable to request Alby NWC invoice. Reason: %o', error)
189189
}
190190
throw error
191191
}

test/integration/features/rate-limiter/rate-limiter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ When(/(\w+) sends a text_note event expecting to be rate limited/, async functio
4343

4444
await new Promise<void>((resolve, reject) => {
4545
ws.send(JSON.stringify(['EVENT', event]), (err) => {
46-
if (err) reject(err)
47-
else resolve()
46+
if (err) {
47+
reject(err)
48+
} else {
49+
resolve()
50+
}
4851
})
4952
})
5053

0 commit comments

Comments
 (0)