confusing error messages

Started by dbuchhorn, August 15, 2018, 08:50:33 AM

Previous topic - Next topic

dbuchhorn

I do some tests with exiftool and I try what happen if an unknown file type or a non existing file is used as input file.
Test 1:
>exiftool.exe -Author:test unknown.type
Error: Unknown file type - unknown.type

The result of the first test is what I expected.

Test 2:
>exiftool.exe -Author:test not_found.jpg
File not found: not_found.jpg

If a file could not be found is not an error, because the message is not prefixed with "Error:"? I guess this is the difference between errors and warnings.

Test 3:
>exiftool.exe -Author:test unknown.type -o test.jpg
Error: Can't create JPEG files from scratch
    1 files weren't created due to errors

Test 4:
>exiftool.exe -Author:test not_found.jpg -o test.jpg
Error: Can't create JPEG files from scratch
    1 files weren't created due to errors

The error in the 3th test is confusing, because it hides the Unknown Type Error. I want to use exiftool from java and forward the error messages. Now the problem is that a support person must have some specific knowledge to interpret the error message. And also the error can have at least two source errors (file not found or unknown type).

Phil Harvey

Thanks for your comments.

Quote from: dbuchhorn on August 15, 2018, 08:50:33 AM
Test 2:
>exiftool.exe -Author:test not_found.jpg
File not found: not_found.jpg

If a file could not be found is not an error, because the message is not prefixed with "Error:"? I guess this is the difference between errors and warnings.

There are a number of places where the "File not found" error is generated.  I will try to make these consistently:

Error: File not found - not_found.jpg

QuoteTest 3:
>exiftool.exe -Author:test unknown.type -o test.jpg
Error: Can't create JPEG files from scratch
    1 files weren't created due to errors

Test 4:
>exiftool.exe -Author:test not_found.jpg -o test.jpg
Error: Can't create JPEG files from scratch
    1 files weren't created due to errors

The error in the 3th test is confusing, because it hides the Unknown Type Error. I want to use exiftool from java and forward the error messages. Now the problem is that a support person must have some specific knowledge to interpret the error message. And also the error can have at least two source errors (file not found or unknown type).

In general, ExifTool aborts processing when an error is found, so subsequent errors may not be detected.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dbuchhorn

Thanks for your quick answer.

For clarifying I want to ask some more questions.

1) All messages printed on standard error are errors? There are no warning messages?

2)
QuoteIn general, ExifTool aborts processing when an error is found, so subsequent errors may not be detected.
The error response is not correct and a file not found or unknown type error should be reported?

Phil Harvey

Quote from: dbuchhorn on August 16, 2018, 05:53:59 AM
1) All messages printed on standard error are errors? There are no warning messages?

No.  Warnings may also be printed to stderr.  Also informational messages go to stderr in some cases.

Quote2)
QuoteIn general, ExifTool aborts processing when an error is found, so subsequent errors may not be detected.
The error response is not correct and a file not found or unknown type error should be reported?

I don't understand.  The "Can't create JPEG files from scratch" is correct, and ExifTool aborts the command without checking the file because it can't be completed.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dbuchhorn

QuoteNo.  Warnings may also be printed to stderr.  Also informational messages go to stderr in some cases.
How to identify a warning, information or error message?

QuoteI don't understand.  The "Can't create JPEG files from scratch" is correct, and ExifTool aborts the command without checking the file because it can't be completed.
The message "Can't create JPEG files from scratch" is because the file could not be found (or is an unknown type). The program stop executing if no output file is given and report the "file not found" error. If an output file is given then the program continues without reading any data. After this it breaks with "Can't create JPEG files from scratch". If so maybe the file not found should at least reported as a warning message too.

Phil Harvey

First, I think we should start with a command that makes sense.  In your test commands, the -Author:test argument is meaningless when -o is used.  Since you aren't writing any other tags, -o will fail if the source file doesn't exist, but it won't fail if you assign a tag value.  So in that context the "file not found" is a warning, not an error.  However, you may also have an issue with the resulting warning:

Warning: Error opening file - unknown.type

But my point is that "file not found" is not the critical error that stops your test 3.

(BTW. the error you gave for test 4 is wrong I think.  I get "Error opening file" for that test.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dbuchhorn

#6
You are right the 4th test is wrong, sorry for that (maybe copy and paste  ???).

Ok I understand. If tags are written and the -o option is used then a non existing source file will stop the program (like it does without the -o option).
>exiftool.exe -XResolution=72 -YResolution=72 not_found.jpg -o test.jpg
Error: Error opening file - not_found.jpg (stderr)
    0 image files updated                        (stdout)
    1 files weren't updated due to errors  (stdout)

Only if the file can be found but has an unknown type the program will continue.
>exiftool.exe -XResolution=72 -YResolution=72 unknown.type -o test.jpg
Error: Can't create JPEG files from scratch (stderr)
    1 files weren't created due to errors      (stdout)

Thank you for clarifying this, because I expect the program will stop with an error like "Error: Unknown file type". I also find my mistake. I use a wrong Syntax (XResolution:72 and it must be XResolution=72). With the right Syntax the right error messages will be reported.
>exiftool.exe -XResolution=72 -YResolution=72 unknown.type
Error: Writing of this type of file is not supported - unknown.type
    0 image files updated
    1 files weren't updated due to errors

Thanks for your time.

Phil Harvey

You aren't writing tags with those commands.  You need an equal sign (=), not a colon (:).  ie)

exiftool.exe -Author=test -XResolution=72 -YResolution=72 not_found.jpg -o test.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dbuchhorn

Right, I see this right now too and I corrected my last commend. Thanks.