prevent not_auth errors
This commit is contained in:
parent
7a51780a6e
commit
9f0b4f4272
3 changed files with 11 additions and 1 deletions
|
|
@ -239,6 +239,10 @@ const getGun = () => {
|
|||
}
|
||||
|
||||
const getUser = () => {
|
||||
if (!user.is) {
|
||||
logger.warn('called getUser() without being authed')
|
||||
throw new Error('NOT_AUTH')
|
||||
}
|
||||
return user
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -527,11 +527,11 @@ const onChats = cb => {
|
|||
|
||||
if (!onChatsSubbed) {
|
||||
const Streams = require('../streams')
|
||||
onChatsSubbed = true
|
||||
onOutgoing(processChats)
|
||||
Streams.onAvatar(processChats)
|
||||
Streams.onDisplayName(processChats)
|
||||
Streams.onPubToFeed(processChats)
|
||||
onChatsSubbed = true
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
|
|
|||
|
|
@ -105,6 +105,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
|
|||
}
|
||||
} catch (e) {
|
||||
logger.error(e)
|
||||
if (e.message === 'NOT_AUTH') {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(
|
||||
|
|
@ -132,6 +135,9 @@ const tryAndWait = async (promGen, shouldRetry = () => false) => {
|
|||
}
|
||||
} catch (e) {
|
||||
logger.error(e)
|
||||
if (e.message === 'NOT_AUTH') {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue