Improve error message

This commit is contained in:
Yarmo Mackenbach 2020-12-05 23:10:48 +01:00
parent b03eebc0dc
commit f49e9029e9
2 changed files with 3 additions and 3 deletions

View file

@ -159,7 +159,7 @@ const verify = async (input, fingerprint, opts) => {
opts = mergeOptions(defaultOpts, opts ? opts : {}) opts = mergeOptions(defaultOpts, opts ? opts : {})
if (!validUrl.isUri(uri)) { if (!validUrl.isUri(uri)) {
throw new Error('Not a valid URI') throw new Error('Invalid URI')
} }
const spMatches = serviceproviders.match(uri, opts) const spMatches = serviceproviders.match(uri, opts)

View file

@ -64,11 +64,11 @@ describe('claims.verify', () => {
}) })
it('should throw an error for non-valid URIs', () => { it('should throw an error for non-valid URIs', () => {
return expect(doipjs.claims.verify('noURI')).to.eventually.be.rejectedWith( return expect(doipjs.claims.verify('noURI')).to.eventually.be.rejectedWith(
'Not a valid URI' 'Invalid URI'
) )
return expect( return expect(
doipjs.claims.verify('domain.org') doipjs.claims.verify('domain.org')
).to.eventually.be.rejectedWith('Not a valid URI') ).to.eventually.be.rejectedWith('Invalid URI')
}) })
doipjs.serviceproviders.list.forEach((spName, i) => { doipjs.serviceproviders.list.forEach((spName, i) => {