-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
Hi @adamrehn
Per our conversation with @TBBle under #65, looks like there are several bare exceptions in current API.
This is considered a bad practice and non-Pythonic way of catching exceptions - reference1, reference2
It can potentially suppress unwanted exceptions and hide bugs. Something that we don't really want.
Fixing it right now is a bit risky, especially at this stage of the project. It would require some retesting and probably adding more code for edge cases. However, it would be a good change after all. I can try fixing it.
Let me know what do you think!
Example:
ue4cli/ue4cli/UnrealManagerBase.py
Lines 167 to 178 in fed71c1
| def getDescriptor(self, dir): | |
| """ | |
| Detects the descriptor file for either an Unreal project or an Unreal plugin in the specified directory | |
| """ | |
| try: | |
| return self.getProjectDescriptor(dir) | |
| except: | |
| try: | |
| return self.getPluginDescriptor(dir) | |
| except: | |
| raise UnrealManagerException('could not detect an Unreal project or plugin in the directory "{}"'.format(dir)) | |
For reference, grep shows at least 7 usages of bare exception:
╰─$ grep -Rno "except:" .
./ue4cli/UE4BuildInterrogator.py:192:except:
./ue4cli/UnrealManagerBase.py:52:except:
./ue4cli/UnrealManagerBase.py:173:except:
./ue4cli/UnrealManagerBase.py:176:except:
./ue4cli/UnrealManagerWindows.py:9:except:
./ue4cli/UnrealManagerWindows.py:42:except:
./ue4cli/UnrealManagerWindows.py:95:except:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels