Skip to content

Commit

Permalink
Merge pull request #132 from kaleido-io/conflict
Browse files Browse the repository at this point in the history
Pass 409 Conflict back to FireFly Core
  • Loading branch information
peterbroadhurst committed Sep 28, 2023
2 parents ed138d8 + 714a848 commit 1be9caa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tokens/blockchain.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { ClientRequest } from 'http';
import { HttpService } from '@nestjs/axios';
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import {
ConflictException,
HttpStatus,
Injectable,
InternalServerErrorException,
Logger,
Expand Down Expand Up @@ -96,7 +98,13 @@ export class BlockchainConnectorService {
this.logger.warn(
`${request?.path} <-- HTTP ${response?.status} ${response?.statusText}: ${errorMessage}`,
);
throw new InternalServerErrorException(errorMessage);
if (response?.status === HttpStatus.CONFLICT) {
// Pass a 409 through
throw new ConflictException(errorMessage);
} else {
// Otherwise always return a 500 if the blockchain connector request wasn't successful
throw new InternalServerErrorException(errorMessage);
}
}
throw err;
});
Expand Down

0 comments on commit 1be9caa

Please sign in to comment.