Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the cause of CommandFailedException #43

Merged
merged 4 commits into from
Oct 23, 2015

Conversation

lewislabs
Copy link
Contributor

Mjolnir wraps exceptions thrown by its invoked methods in a CommandFailedException. In cases where the thrown exception was of type OperationCancelledException, we want to know the reason for this cancellation. Was the cancellation made explicitly by the user or was it tripped by Mjolnir's preset timeout.

This change adds an additional piece of data to the CommandFailedException to express the cause of cancellation.

…ne the reason for a TaskCancellationException
Command = Name,
Timeout = Timeout.TotalMilliseconds,
Status = status,
CommandCancellationReason = tokenSourceCancelled ? CommandCancellationReason.TimeoutCancellation : CommandCancellationReason.CallerTokenCancellation,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we wanted to DRY this up a bit, we could just make this field a "FailureReason" or something (i.e. not timeout-specific) and set it to "Faulted" for non-cancellations.

@robhruska
Copy link
Member

I think we should change the exception message for known timeouts from "Command canceled" to "Command timed out". That's more visible in our logs than exception data, and will be more helpful for quick incident diagnosis.

@lewislabs
Copy link
Contributor Author

I've now added specific exceptions for each case (timeout, cancelled, rejected). Each of these derives from CommandFailedException, so that there isn't a breaking change. I've kept the Status inside of the base class as well, again to avoid a breaking change.

lewislabs added a commit that referenced this pull request Oct 23, 2015
Find out the true cause of a CommandFailedException
@lewislabs lewislabs merged commit e9cbbfd into master Oct 23, 2015
@lewislabs lewislabs deleted the Plat-MakeSenseOfTimeoutCause branch November 17, 2015 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants