expectRecordingError function

void expectRecordingError(
  1. Pointer<Void> e,
  2. String context
)

Same as expectAimuxError for calls that can fail in the recorder ([RecordingError]): 100..105 → RecordingException; 200..206 → invariant StateError.

Implementation

void expectRecordingError(Pointer<Void> e, String context) {
  if (e == nullptr) return;
  final Object failure;
  try {
    final code = _errorCode(e);
    failure = _isFfiCode(code)
        ? _ffiError(e, context)
        : RecordingException._decode(e);
  } finally {
    _errorFree(e);
  }
  throw failure;
}