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

[Bug]: Error messages need cleaned up #182

Open
makubacki opened this issue Nov 1, 2022 · 0 comments
Open

[Bug]: Error messages need cleaned up #182

makubacki opened this issue Nov 1, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@makubacki
Copy link
Member

Contact Details

No response

Describe the Bug

Function in the codebase assume errors in places they should not. This leads to erroneous error printing which can increase if these functions are called more often in the future.

This is particularly true for "helper" functions. The function has no context of the caller's intentions. Therefore, it should not consider being called an error.

For example:

https://github.com/tianocore/edk2-pytool-library/blob/master/edk2toollib/uefi/edk2/path_utilities.py

GetContainingPackage() outputs error messages if the given input path is not in package. That might not be an error. The caller might simply want to check if the path is in a package. Only the caller can determine if the presence of the given path in or out of a package is an error.

Some functions such as def GetAbsolutePathOnThisSystemFromEdk2RelativePath(self, relpath, log_errors=True) allow the caller to control error printing but this complicates the function interface for no reason. The caller can easily print an error based on the function return value; the function simply needs to return that value.

Reproduction steps

Perform source code review of functions in this repository for cases where error messages are printed based on assumptions about the caller.

Expected behavior

Error messages are only printed in the cases of true errors. If an exceptional circumstance occurs outside the defined return value of the function, exceptions should be used and documented.

Execution Environment

No response

Pip packages

No response

Additional context

No response

@makubacki makubacki added the bug Something isn't working label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant