Compare commits
4 Commits
a99c16a3a7
...
33ed372236
Author | SHA1 | Date | |
---|---|---|---|
33ed372236 | |||
|
f6a2f4aa48 | ||
7c2b8dc53e | |||
|
608400d010 |
@ -214,8 +214,22 @@ export class NostrController extends EventEmitter {
|
||||
}
|
||||
})
|
||||
|
||||
if (publishedRelays.length === 0)
|
||||
throw new Error(`Couldn't publish to any relay`)
|
||||
if (publishedRelays.length === 0) {
|
||||
const failedPublishes: any[] = []
|
||||
|
||||
results.forEach((res, index) => {
|
||||
if (res.status === 'rejected') {
|
||||
failedPublishes.push(
|
||||
{
|
||||
relay: relays[index],
|
||||
error: res.reason.message
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
throw failedPublishes
|
||||
}
|
||||
|
||||
return publishedRelays
|
||||
}
|
||||
|
@ -161,9 +161,14 @@ export const sendDM = async (
|
||||
.then((relays) => {
|
||||
toast.success(`Encrypted DM sent on: ${relays.join('\n')}`)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err :>> ', err)
|
||||
toast.error(err.message || 'An error occurred while publishing DM')
|
||||
.catch((errResults) => {
|
||||
console.log('err :>> ', errResults)
|
||||
toast.error('An error occurred while publishing DM')
|
||||
|
||||
errResults.forEach((errResult: any) => {
|
||||
toast.error(`Publishing to ${errResult.relay} caused the following error: ${errResult.error}`)
|
||||
})
|
||||
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user