5#include "../Common/ResultErrorFormatter.h"
6#include "FibersError.h"
12inline ResultErrorFormat formatFibersError(
FibersError error, Span<char> output)
14 ResultErrorFormatter formatter(output);
17 case FibersError::InvalidState: formatter.append(
"Operation is invalid in the current state");
break;
18 case FibersError::WrongOwner: formatter.append(
"Resource belongs to another owner");
break;
19 case FibersError::WrongScheduler: formatter.append(
"Work belongs to another scheduler");
break;
20 case FibersError::WrongExecutionContext:
21 formatter.append(
"Operation requires a different execution context");
23 case FibersError::InvalidConfiguration: formatter.append(
"Configuration is invalid");
break;
24 case FibersError::CapacityExceeded: formatter.append(
"Capacity limit exceeded");
break;
25 case FibersError::StorageTooSmall: formatter.append(
"Storage is too small");
break;
26 case FibersError::GroupStorageTooSmall: formatter.append(
"Group error storage is too small");
break;
27 case FibersError::SlotUnavailable: formatter.append(
"No slot is available");
break;
28 case FibersError::QueueUnavailable: formatter.append(
"Queue cannot accept more work");
break;
29 case FibersError::InvalidProcedure: formatter.append(
"Procedure is invalid");
break;
30 case FibersError::OperationUnsupported: formatter.append(
"Operation is unsupported");
break;
31 case FibersError::Cancelled: formatter.append(
"Work was cancelled");
break;
32 case FibersError::NoProgress: formatter.append(
"Scheduler made no progress");
break;
33 case FibersError::CounterUnderflow: formatter.append(
"Counter is already zero");
break;
34 case FibersError::SynchronizationViolation: formatter.append(
"Synchronization precondition was violated");
break;
35 case FibersError::GroupNotReset: formatter.append(
"Group must be reset before another work wave");
break;
36 case FibersError::UnexpectedWorkerState: formatter.append(
"Worker has work in an unexpected state");
break;
37 case FibersError::AllocationFailed: formatter.append(
"Allocation failed");
break;
38 case FibersError::MemoryReservationFailed: formatter.append(
"Memory reservation failed");
break;
39 case FibersError::MemoryCommitFailed: formatter.append(
"Memory commitment failed");
break;
40 case FibersError::MemoryDecommitFailed: formatter.append(
"Memory decommitment failed");
break;
41 case FibersError::MemoryReleaseFailed: formatter.append(
"Memory release failed");
break;
42 case FibersError::MemoryProtectionFailed: formatter.append(
"Memory protection failed");
break;
43 case FibersError::StackGrowthPreparationFailed: formatter.append(
"Stack growth preparation failed");
break;
44 case FibersError::StackGuardPreparationFailed: formatter.append(
"Stack guard preparation failed");
break;
45 case FibersError::SignalHandlerInstallFailed:
46 formatter.append(
"Stack growth signal handler installation failed");
48 case FibersError::SignalHandlerRestoreFailed:
49 formatter.append(
"Stack growth signal handler restoration failed");
51 case FibersError::SignalStackInstallFailed: formatter.append(
"Signal stack installation failed");
break;
52 case FibersError::SignalStackRestoreFailed: formatter.append(
"Signal stack restoration failed");
break;
53 case FibersError::ThreadStartFailed: formatter.append(
"Worker thread could not start");
break;
54 case FibersError::ThreadJoinFailed: formatter.append(
"Worker thread could not be joined");
break;
55 case FibersError::ThreadPriorityApplyFailed: formatter.append(
"Worker thread priority could not be applied");
break;
56 case FibersError::ThreadAffinityApplyFailed: formatter.append(
"Worker thread affinity could not be applied");
break;
57 default:
return ResultErrorFormatter::failure(ResultErrorFormatStatus::UnknownError, output);
59 return formatter.finish();
62inline ResultErrorFormat formatFibersError(Result result, Span<char> output)
65 return ResultErrorFormatter::failure(ResultErrorFormatStatus::NotAnError, output);
66 if (result.category() != FibersResultCategory)
67 return ResultErrorFormatter::failure(ResultErrorFormatStatus::ForeignCategory, output);
68 return formatFibersError(
static_cast<FibersError>(result.errorValue()), output);
FibersError
Stable portable failures owned by Fibers.
Definition FibersError.h:15