Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/discovery/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export class DiscoveryClient {
async findService(resourceUri: string, channelType: ChannelType): Promise<SubscriptionService | null> {

const storageDescription = await this.fetchStorageDescription(resourceUri)
// If no storage description is found, return null
if (storageDescription === null) return null

// TODO handle multiple matching services
const serviceNode = getOneMatchingQuad(storageDescription, null, NOTIFY.channelType, DataFactory.namedNode(channelType))?.subject
Expand Down Expand Up @@ -54,8 +56,10 @@ export class DiscoveryClient {
return getStorageDescription(response.headers.get('Link'))
}

async fetchStorageDescription(resourceUri): Promise<DatasetCore> {
async fetchStorageDescription(resourceUri): Promise<DatasetCore | null> {
const storageDescriptionUri = await this.discoverStorageDescription(resourceUri)
// If no storage description is found, return null
if (!storageDescriptionUri) return null
return this.fetchResource(storageDescriptionUri)
}

Expand Down