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

Error handler #31

Closed
KajFRasmussen opened this issue Nov 4, 2021 · 5 comments
Closed

Error handler #31

KajFRasmussen opened this issue Nov 4, 2021 · 5 comments

Comments

@KajFRasmussen
Copy link

Would it be possible to create an error handler routine, where the user gets meaningful feedback, like "Error in line 122 in CSV, conversion halted", instead of the code simply crashing and leaving the python errorhandler to report, which can make tracing errors hard.
-Maybe Python isn't up to this task?

@archaeodav
Copy link
Owner

We can catch exceptions pretty easily in python but ideally we'd try to anticipate what they are and catch and handle specific types of exception, so if you have a file that's causing problems please share.

Returning an error from a specific line in the text file is pretty complicated as most of these fails are going to be caused by geometries / features as a whole causing problems. If you are having problems it's probably caused by the validator method crashing on a feature it doesn't like- see issue #26 for an example. Again, if you're having problems please share the file so we can see what's going on

Python is more than up to the task for this- I'd argue more so that any other language given how fully featured the PyQgis API is, but if you have suggestions for a better alternative I'm all ears.

@KajFRasmussen
Copy link
Author

KajFRasmussen commented Nov 5, 2021

The most resent crash for me was a CSV with the "erroneous" coding code "-FELT2". Changing to "-FELT2 1" solved the issue.
-felt2 without a number assigned could probably just be regarded as number "null" or 0.
The same issue is probably present in -felt1
-you are probably right in assuming it is the validator that crashes...

@archaeodav
Copy link
Owner

Can you please send the file? That shouldn't and doesn't crash anything in my test data, so there's probably something else going on.

@KajFRasmussen
Copy link
Author

KajFRasmussen commented Nov 5, 2021 via email

@archaeodav
Copy link
Owner

OK. Sounds like the afforementioned issue #26. I'll mark this as closed now. I've marked 1.01 as stable so it should install that as default going forward.

If you have requests for additional features rather than specific issues faults please put them in the discussion rather than here.

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

No branches or pull requests

2 participants