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

Replace explicit checks for DeveloperErrors with calls to the new Check type #4794

Closed
pjcozzi opened this issue Dec 31, 2016 · 5 comments
Closed
Labels
category - architecture / api cleanup good first issue An opportunity for first time contributors

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 31, 2016

#4726 introduced a new private class, Check, with static utility functions to do common parameter validation and throw a DeveloperError. Using Check instead of explicit hand-coded conditionals is more concise. For example:

if (!defined(cartesian)) {
    throw new DeveloperError('cartesian is required');
}

becomes

Check.typeOf.object('cartesian', cartesian);

#4726 also updated Cartesian3 to use Check.

We still want to update the rest of the Cesium codebase to use Check when reasonable (very specific checks for DeveloperErrors can still be hand-coded). This is a great beginner issue.

  • Start with the fundamental numeric types in the Core directory: cartesian, matrices, quaternions, etc.
  • Open a pull request for one file at a time to start.
  • Verify the reference documentation for the @exceptions is still correct and that there are unit tests for the exceptions in the corresponding Spec file (try the WebStorm plugin to flip between the source and spec file).
@pjcozzi pjcozzi added good first issue An opportunity for first time contributors cleanup labels Dec 31, 2016
@pjcozzi
Copy link
Contributor Author

pjcozzi commented Jan 9, 2017

@shehzan10

  • Matrix2
  • Matrix4
  • Cartesian4
  • Spherical

@austinEng

  • Matrix3
  • Cartesian2
  • Quaternion
  • Rectangle

All of these files are in the Core directory.

@lilleyse
Copy link
Contributor

lilleyse commented May 30, 2017

@WilliamKHo @moneimne @omh1280 @AnimatedRNG Let's work on these to start. Open a separate pull request for each file to start.

@rahwang would you like to do the first round of reviews for these?

All these files are in the Core directory. For any checks that involve arrays, just use Check.defined as there is not a Check.typeOf.array. Some checks may also require using Check.typeOf.number.lessThan and related functions.

@WilliamKHo

  • arrayRemoveDuplicates
  • AttributeCompression (fix any of the "____ is required" checks, skip others)
  • AxisAlignedBoundingBox
  • barycentricCoordinates

@moneimne

  • binarySearch
  • BingMapsGeocoderService
  • BoxGeometry
  • BoxOutlineGeometry

@omh1280

  • Cartesian2 (fix just the "left and right are required" checks)
  • Cartesian3 (fix just the "____ is required" checks)
  • Cartographic
  • CartographicGeocoderService

@AnimatedRNG

  • Event
  • Color
  • Ellipsoid - skip "Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
  • Geometry - skip "All attribute lists must have the same number of attributes"
@rahwang
Copy link
Contributor

rahwang commented May 30, 2017

I'd be happy to @lilleyse !

@WilliamKHo @moneimne @omh1280

When you open a pull request for any of these, please tag. Ping if you need help!

@ottaviohartman
Copy link
Contributor

ottaviohartman commented Jun 28, 2017

@rms13

@Rudraksha20

@ggetz
Copy link
Contributor

ggetz commented Apr 13, 2023

This is unlikely to become a priority anytime soon. We'd still happily accept a PR addressing this issue. But tracking this isn't particularly useful because of its low priority, so I will close it. Thanks!

@ggetz ggetz closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category - architecture / api cleanup good first issue An opportunity for first time contributors
5 participants