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

Refactor usage of exceptions in converters/connectors #286

Merged
merged 8 commits into from
Oct 16, 2024

Conversation

AlanRynne
Copy link
Member

@AlanRynne AlanRynne commented Sep 27, 2024

These are the existing exceptions right now:

  • SpeckleException
  • ConversionNotSupportedException
  • ConversionException
  • UnitNotSupportedException
  • ValidationException

Connectors now use exclusively SpeckleException instead of a mix of that and conversionexceptions.

The only place where ConversionNotSupported is expected is within a RootObjectConverter.

ValidationException is thrown if we can verify the data is wrong BEFORE we can attempt conversion
ConversionException should be used for anything else.

We can expand the types more as we find more use-cases to unify.

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 14.28571% with 60 lines in your changes missing coverage. Please review.

Project coverage is 8.41%. Comparing base (da0a35a) to head (d190335).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
....Converters.Common/ToHost/ConverterWithFallback.cs 0.00% 8 Missing ⚠️
...erters.RevitShared/Helpers/ParameterValueSetter.cs 0.00% 7 Missing ⚠️
...ers.RevitShared/Helpers/ParameterValueExtractor.cs 0.00% 5 Missing ⚠️
...ed/ToHost/Raw/BaseToHostGeometryObjectConverter.cs 0.00% 3 Missing ⚠️
...peckle.Converters.Common/RootToSpeckleConverter.cs 0.00% 3 Missing ⚠️
...verters.RevitShared/RevitRootToSpeckleConverter.cs 0.00% 2 Missing ⚠️
...rters.RevitShared/Services/ScalingServiceToHost.cs 0.00% 2 Missing ⚠️
...s.RhinoShared/ToSpeckle/Raw/NurbsCurveConverter.cs 0.00% 2 Missing ⚠️
...e.Converters.Common/LocalToGlobalConverterUtils.cs 0.00% 2 Missing ⚠️
...Converters.Common/Registration/ConverterManager.cs 75.00% 1 Missing and 1 partial ⚠️
... and 24 more
Additional details and impacted files
@@           Coverage Diff            @@
##             dev    #286      +/-   ##
========================================
+ Coverage   8.29%   8.41%   +0.11%     
========================================
  Files        244     240       -4     
  Lines       4882    4815      -67     
  Branches     569     556      -13     
========================================
  Hits         405     405              
+ Misses      4460    4393      -67     
  Partials      17      17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AlanRynne AlanRynne marked this pull request as ready for review October 9, 2024 16:31
Copy link
Member

@adamhathcock adamhathcock left a comment

Choose a reason for hiding this comment

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

I think I follow everything...just making sure about some comments

@KatKatKateryna
Copy link
Contributor

Tested in ArcGIS:

  • SpeckleException
  • ConversionNotSupportedException
  • ConversionException
  • UnitNotSupportedException
  • ValidationException

@@ -311,7 +313,7 @@ List<ObjectConversionTracker> listOfTrackers
{
if (trackerItem.HostAppGeom is not ACG.Geometry shape)
{
throw new SpeckleConversionException("Feature Class element had no converted geometry");
throw new ValidationException("Feature Class element had no converted geometry");
Copy link
Contributor

Choose a reason for hiding this comment

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

possibly we can replace some of the ArgumentExceptions in other converters to ValidationException too

@AlanRynne AlanRynne merged commit fa1fa35 into dev Oct 16, 2024
5 checks passed
@AlanRynne AlanRynne deleted the alan/exception-handling branch October 16, 2024 10:01
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.

4 participants