-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
QgsDistanceArea methods should raise QgsCsException when errors occur #58795
Conversation
Instead of just silently return "0", which is misleading and can result in data corruption/incorrect analysis results. Better to be safe and force callers to handle transformation errors appropriately. In this case we: - raise QgsProcessingExceptions when the failed measurement is coming from a processing tool, so that the user is forced to deal with the issue and we aren't providing meaningless/misleading measurements - report evaluation errors if the measurement is coming from a QGIS expression, so the user must appropriately handle the situation - for all other cases we currently just write a console error and maintain the current behavior of treating the measurement length as 0. TODO notes have been added to handle this cases better.
} | ||
catch ( QgsCsException & ) | ||
{ | ||
// TODO report errors to user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of some (all of) those TODOs? here for instance, we have access to QgisApp visibleMessageBar()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy for someone else to do that, but right now it's not my priority. There's no regression here at least, the behaviour will be identical to current behaviour
Plugins might crash with an unhandled exception though. Should we somehow advertise this change to plugin developers? Mailing list? Other means? |
I realise that, but I think that's preferable to this API silently giving incorrect measurements. At least this way the plugin authors will be advised and make the decision themselves on the best way to handle this situation.
This kind of thing usually goes into the PyQGIS part of the changelog |
This pull request has been tagged for the changelog.
You can edit the description. Format available for credits
Thank you! |
Instead of just silently return "0", which is misleading and can result in data corruption/incorrect analysis results. Better to be safe and force callers to handle transformation errors appropriately.
In this case we: