run<T> method
Call before each operation for automatic renewal. Mutations are never automatically replayed after an ambiguous failure.
Implementation
Future<T> run<T>(
Future<T> Function(DartStreamClient client, DartStreamSession session)
operation,
) async {
final current = await session();
try {
return await operation(client, current);
} on DartStreamApiException catch (e) {
if (e.statusCode == 401) {
_session = null;
_renewAt = null;
}
rethrow;
}
}