Skip to content

Commit

Permalink
fix(rest): ledger not found error
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Apr 14, 2022
1 parent 4378ca6 commit 2374b42
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class CredentialDefinitionController {
try {
return await this.agent.ledger.getCredentialDefinition(credentialDefinitionId)
} catch (error) {
if (error instanceof IndySdkError && isIndyError(error.cause, 'LedgerNotFound')) {
if (error instanceof LedgerNotFoundError) {
throw new NotFoundError(
`credential definition with credentialDefinitionId "${credentialDefinitionId}" not found.`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class SchemaController {
try {
return await this.agent.ledger.getSchema(schemaId)
} catch (error) {
if (error instanceof IndySdkError && isIndyError(error.cause, 'LedgerNotFound')) {
if (error instanceof LedgerNotFoundError) {
throw new NotFoundError(`schema definition with schemaId "${schemaId}" not found.`)
} else if (error instanceof LedgerError && error.cause instanceof IndySdkError) {
if (isIndyError(error.cause.cause, 'LedgerInvalidTransaction')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/tests/credentialDefinition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('CredentialDefinitionController', () => {
expect(response.statusCode).toBe(400)
})

test('should return 404 NotFound when schema not found', async () => {
test('should return 404 NotFound when credential definition not found', async () => {
const response = await request(app).get(`/credential-definitions/WgWxqztrNooG92RXvxSTWv:3:CL:20:tag`)
expect(response.statusCode).toBe(404)
})
Expand Down

0 comments on commit 2374b42

Please sign in to comment.