refactor: updates error handling
This commit is contained in:
parent
791c213e3a
commit
b965623a02
@ -145,11 +145,20 @@ export class MetadataController extends EventEmitter {
|
|||||||
* or a fallback RelaySet with Sigit's Relay
|
* or a fallback RelaySet with Sigit's Relay
|
||||||
*/
|
*/
|
||||||
public findRelayListMetadata = async (hexKey: string): Promise<RelaySet> => {
|
public findRelayListMetadata = async (hexKey: string): Promise<RelaySet> => {
|
||||||
|
try {
|
||||||
const relayEvent =
|
const relayEvent =
|
||||||
(await findRelayListInCache(hexKey)) ||
|
(await findRelayListInCache(hexKey)) ||
|
||||||
(await findRelayListAndUpdateCache(DEFAULT_LOOK_UP_RELAY_LIST, hexKey))
|
(await findRelayListAndUpdateCache(DEFAULT_LOOK_UP_RELAY_LIST, hexKey))
|
||||||
|
|
||||||
return relayEvent ? getUserRelaySet(relayEvent.tags) : getDefaultRelaySet()
|
return relayEvent
|
||||||
|
? getUserRelaySet(relayEvent.tags)
|
||||||
|
: getDefaultRelaySet()
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(
|
||||||
|
`An error occurred while finding relay list metadata for ${hexKey}`,
|
||||||
|
{ cause: error }
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extractProfileMetadataContent = (event: Event) => {
|
public extractProfileMetadataContent = (event: Event) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user