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

[loaders-] handle exceptions in filetype guess #2412

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

midichef
Copy link
Contributor

Exceptions during filetype guessing are usually invisible, and only show up when running vd --debug. This PR handles a couple of these usually invisible exceptions, to clean up the debug status log.

Empty files cause empty messages for a few filetypes: echo -n '' |vd --debug

guess_jsonla: 
guess_json: 
guess_csv: 

And a JSON file causes an error in the JSONLA guesser: echo '[\n{"id": 1}\n]' |vd --debug

guess_jsonla: Expecting value: line 2 column 1 (char 2)```

@saulpw
Copy link
Owner

saulpw commented May 28, 2024

We don't necessarily have to log any errors, even in debug output; maybe should we just remove that instead of trying to handle all exceptions in each guesser? I only put it there because it seemed like it would be handy for when someone was trying to debug why the file type wasn't being guessed correctly for some file, or when writing or updating a guesser. But maybe it's just noisy for the vast majority of times we use --debug.

@midichef
Copy link
Contributor Author

The error log is useful for me at the moment. I'm using --debug to check for errors in file guessing, as I try to make a binary version of RepeatFile. That's how I noticed the errors in these corner cases. So it is handy for now.

@anjakefala anjakefala merged commit 8c16d46 into saulpw:develop Jun 25, 2024
13 checks passed
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.

None yet

3 participants