rollbackTransaction method
Future<void>
rollbackTransaction({
- required TransactionHeaders headers,
- required TransactionInfo info,
override
Rollback a transaction.
Implementation
@override
Future<void> rollbackTransaction(
{required TransactionHeaders headers,
required TransactionInfo info}) async {
final Uri url = (info as DataProxyTxInfo).endpoint;
final Uri endppoint = url.replace(
pathSegments: [
...url.pathSegments,
'rollback',
],
);
final Response response = await post(
endppoint,
headers: runtimeHttpHeadersBuilder(headers.toJson()),
);
if (response.statusCode > 400) {
final e = PrismaClientUnknownRequestError('Bad request',
clientVersion: binaryVersion);
logEmitter.emit(PrismaLogLevel.error, e);
throw e;
}
final Map<String, dynamic> json = jsonDecode(response.body);
try {
throwGraphQLError(json['errors']);
} on Exception catch (e) {
logEmitter.emit(PrismaLogLevel.error, e);
rethrow;
}
}