5#include "../Common/ResultErrorFormatter.h"
6#include "AsyncFibersError.h"
12inline ResultErrorFormat formatAsyncFibersError(
AsyncFibersError error, Span<char> output)
14 ResultErrorFormatter formatter(output);
17 case AsyncFibersError::Cancelled: formatter.append(
"Fiber I/O operation was cancelled");
break;
18 case AsyncFibersError::SocketSendNoProgress: formatter.append(
"Socket send made no progress");
break;
19 case AsyncFibersError::InvalidFileHandle: formatter.append(
"File handle is invalid");
break;
20 case AsyncFibersError::UnexpectedEndOfFile:
21 formatter.append(
"File ended before the requested data was read");
23 case AsyncFibersError::WrongOwnerThread: formatter.append(
"Fiber I/O must run on its owner thread");
break;
24 case AsyncFibersError::FiberContextRequired: formatter.append(
"Operation requires a running fiber");
break;
25 case AsyncFibersError::CommandStorageEmpty: formatter.append(
"Command queue has no storage");
break;
26 case AsyncFibersError::InvalidCommand: formatter.append(
"Command is invalid");
break;
27 case AsyncFibersError::CommandQueueFull: formatter.append(
"Command queue is full");
break;
28 default:
return ResultErrorFormatter::failure(ResultErrorFormatStatus::UnknownError, output);
30 return formatter.finish();
33inline ResultErrorFormat formatAsyncFibersError(Result result, Span<char> output)
36 return ResultErrorFormatter::failure(ResultErrorFormatStatus::NotAnError, output);
37 if (result.category() != AsyncFibersResultCategory)
38 return ResultErrorFormatter::failure(ResultErrorFormatStatus::ForeignCategory, output);
39 return formatAsyncFibersError(
static_cast<AsyncFibersError>(result.errorValue()), output);
AsyncFibersError
Stable portable failures owned by the AsyncFibers bridge.
Definition AsyncFibersError.h:15