archaeodav / felttegn

Public repository for FeltTegn, a Qgis Plugin for processing survey data from archaeological excavations conducted by Danish Museums
GNU General Public License v3.0
5 stars 1 forks source link

Error handler #31

Closed KajFRasmussen closed 2 years ago

KajFRasmussen commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Funny...

I just tested it on 1.0.1., and it went through with no issues. Maybe an error specific to 1.0.0?

Med venlig hilsen Kaj F. Rasmussen Mob +45 2442 5001

From: David Stott @.> Sent: Friday, 5 November 2021 14.07 To: archaeodav/felttegn @.> Cc: Kaj Fredsgaard Rasmussen @.>; Author @.> Subject: Re: [archaeodav/felttegn] Error handler (Issue #31)

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/archaeodav/felttegn/issues/31#issuecomment-961880085, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASQQZ2LMDJDULFADML3QE4TUKPJFVANCNFSM5HLGVEGQ.

archaeodav commented 2 years ago

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.