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

feat: update SdkException and subtypes #166

Merged
merged 3 commits into from
Sep 22, 2022
Merged

Conversation

pgautier404
Copy link
Contributor

Adds errorCode and transportDetails properties.

Adds errorCode and transportDetails properties.
@pgautier404 pgautier404 marked this pull request as ready for review September 21, 2022 20:03
Copy link
Contributor

@cprice404 cprice404 left a comment

Choose a reason for hiding this comment

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

lgtm! just a handful of minor questions/nits

public AlreadyExistsException(string message) : base(message, MomentoErrorCode.ALREADY_EXISTS_ERROR)
{
}
public AlreadyExistsException(string message, MomentoErrorTransportDetails transportDetails) : base(message, MomentoErrorCode.ALREADY_EXISTS_ERROR, transportDetails)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know the name MomentoErrorTransportDetails is from my spec doc, but curious how folks feel about it. Open to shortening it if it seems to verbose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with it. I prefer self documenting to terse.

CLIENT_RESOURCE_EXHAUSTED,
FAILED_PRECONDITION_ERROR,
UNKNOWN_ERROR
}
Copy link
Contributor

Choose a reason for hiding this comment

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

i know you may have this in a branch already and it's fine for it to be in a PR, but we should see if we can add some comment strings here that make these a little more clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is indeed on a branch that will be rolling out as a PR as soon as I merge this one.

public MomentoErrorCode errorCode;
public MomentoErrorTransportDetails? transportDetails = null;

protected SdkException(string message, MomentoErrorCode errorCode) : base(message)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a super nitpick but I feel like it's more typical/idiomatic to have the enum be the first arg in a signature like this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair. Fixed in fd2de77.

}
protected SdkException(string message, Exception e) : base(message, e)
protected SdkException(string message, MomentoErrorCode errorCode, MomentoErrorTransportDetails? transportDetails, Exception e) : base(message, e)
Copy link
Contributor

Choose a reason for hiding this comment

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

since these are all protected and the implementations are simple, I'd vote for just having a single constructor that takes all of the args.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also fixed in fd2de77.

cprice404
cprice404 previously approved these changes Sep 22, 2022
Copy link
Contributor

@malandis malandis left a comment

Choose a reason for hiding this comment

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

Just some minor style points

src/Momento.Sdk/Exceptions/SdkException.cs Outdated Show resolved Hide resolved
src/Momento.Sdk/Exceptions/SdkException.cs Outdated Show resolved Hide resolved
@pgautier404 pgautier404 merged commit d757c1b into main Sep 22, 2022
@pgautier404 pgautier404 deleted the feat/update-error-types branch September 22, 2022 17:30
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.

3 participants