Samsung / ONE

On-device Neural Engine
Other
427 stars 151 forks source link

[one-cmds] Not printing error location #7487

Open mhs4670go opened 3 years ago

mhs4670go commented 3 years ago

What

Let's print a line number where the error occurred.

Related: #7426

Why

Current one-cmds message looks like this.

FileNotFoundError: [Errno 2] No such file or directory: './bcq_null.pb'

During handling of the above exception, another exception occurred:

NameError: name 'os' is not defined
one-import-bcq_neg_003.test FAILED

This error makes it hard to know where the error happened. Printing the error line number would be helpful.

glistening commented 3 years ago

@mhs4670go

First, I think the statement

Current one-cmds message looks like this.

may be misleading.

Your example is not typical error message of one-cmds.

one-cmds are supposed to print user error message in module-name: error type: error message as much as possible.

With fix of #7459, it prints like:

$ ./one-import-bcq -i bcq_null.pb -o bcq.circle -I Placeholder -O MatMul
generate_bcq_metadata.py: FileNotFoundError: [Errno 2] No such file or directory: 'bcq_null.pb'

Second, if you are suggesting to print traceback for one-cmds developer to help debug, please note that we've deliberately suppressed traceback. See #7297.

Perhaps, (because I think you already know these), I guess you want

$ ./one-import-bcq -i bcq_null.pb -o bcq.circle -I Placeholder -O MatMul
generate_bcq_metadata.py:226: FileNotFoundError: [Errno 2] No such file or directory: 'bcq_null.pb'

Am I right? If not, could you please specify your suggestion in detail?

mhs4670go commented 3 years ago

@glistening

generate_bcq_metadata.py:226: FileNotFoundError: [Errno 2] No such file or directory: 'bcq_null.pb'

This is what I want. Since we suppress the traceback, it is hard to know where the error happened.

glistening commented 3 years ago

@glistening

generate_bcq_metadata.py:226: FileNotFoundError: [Errno 2] No such file or directory: 'bcq_null.pb'

This is what I want. Since we suppress the traceback, it is hard to know where the error happened.

Okay. I got it. But I would like to distinguish the messages for end user and the ones for developers (us). The end user doesn't need to see the line number.

For developers, we may show line number when --verbose is given. It may be better to enable traceback which gives more information for developers.