Skip to content

Commit

Permalink
fix(resolver): change invalid datum action
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Jan 5, 2024
1 parent 30061c5 commit cfb2aa1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/resolver/src/adapters/cns/api-helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('resolveUserRecord', () => {

fail('it should crash before')
} catch (e) {
expect(e).toBeInstanceOf(Resolver.Errors.InvalidResponse)
expect(e).toBeInstanceOf(Resolver.Errors.NotFound)
}
})
})
Expand Down
5 changes: 2 additions & 3 deletions packages/resolver/src/adapters/cns/api-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ export const resolveUserRecord = async (
fetcherConfig,
)

if (!inlineDatum) throw new Resolver.Errors.NotFound()
if (!validateCNSUserRecord(inlineDatum))
throw new Resolver.Errors.InvalidResponse()
if (!inlineDatum || !validateCNSUserRecord(inlineDatum))
throw new Resolver.Errors.NotFound()

const virtualSubdomains = await parseAssocMapAsync(
inlineDatum.fields[0], // validated with validateCNSUserRecord
Expand Down

0 comments on commit cfb2aa1

Please sign in to comment.