commitTransaction method
Future<void>
commitTransaction({
- required TransactionHeaders headers,
- required TransactionInfo info,
override
Commit a transaction.
Implementation
@override
Future<void> commitTransaction(
{required TransactionHeaders headers,
required TransactionInfo info}) async {
final Uri url = (info as DataProxyTxInfo).endpoint;
final Uri endppoint = url.replace(
pathSegments: [
...url.pathSegments,
'commit',
],
);
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;
}
}