private static string GetMessage(CommandCompletionStatus status) { switch (status) { case CommandCompletionStatus.Canceled: return("Command canceled"); case CommandCompletionStatus.Rejected: return("Command rejected"); } return("Command failed"); }
private static string GetMessage(CommandCompletionStatus status) { switch (status) { case CommandCompletionStatus.Canceled: return "Command canceled"; case CommandCompletionStatus.Rejected: return "Command rejected"; } return "Command failed"; }
internal CommandFailedException(Exception cause, CommandCompletionStatus status) : base(GetMessage(status), cause) { IsFallbackImplemented = true; // Assume the best! Actually, we'll just set it to false later if we don't have an implementation. Status = status; }
protected CommandFailedException(string message, Exception cause, CommandCompletionStatus status) : base(message, cause) { IsFallbackImplemented = true; // Assume the best! Actually, we'll just set it to false later if we don't have an implementation. Status = status; }
private static void AttachCommandExceptionData(BaseCommand command, Exception exception, CommandCompletionStatus status, InformativeCancellationToken ct) { // Use namespaced keys here to avoid clobbering data that the application might've // already attached (or will attach later). exception.Data["MjolnirCommand"] = command.Name; exception.Data["MjolnirStatus"] = status; exception.Data["MjolnirBreaker"] = command.BreakerKey.Name; exception.Data["MjolnirBulkhead"] = command.BulkheadKey.Name; exception.Data["MjolnirTimeoutMillis"] = ct.DescriptionForLog; exception.Data["MjolnirExecuteMillis"] = command.ExecutionTimeMillis; }