Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass 409 Conflict back to FireFly Core #132

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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