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

Use expect* methods more + some cleanup #314

Merged
merged 1 commit into from
Mar 16, 2020
Merged

Use expect* methods more + some cleanup #314

merged 1 commit into from
Mar 16, 2020

Conversation

mtdowling
Copy link
Member

This commit uses the expectTrait methods and hasTrait methods more
instead of using .get(). This will give much more clear error messages
in the event of a logical error in code.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mtdowling mtdowling requested a review from srchase March 13, 2020 23:52
This commit uses the expectTrait methods and hasTrait methods more
instead of using .get(). This will give much more clear error messages
in the event of a logical error in code.

This also adds expect* methods that expect a shape to be of a specific
type. This cleans up a lot of call sites that were using an unsafe
.get() after calling .asBlob, asString, etc.
@@ -417,6 +417,319 @@ public boolean hasTrait(Class<? extends Trait> traitClass) {
return Optional.empty();
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Yesssss 🙌

@mtdowling mtdowling merged commit a44123e into 0.10 Mar 16, 2020
@mtdowling mtdowling deleted the use-more-expect branch March 25, 2020 03:35
@kstich kstich mentioned this pull request Apr 23, 2020
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