mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 07:40:38 -08:00
remove BaseException usage
This commit is contained in:
@@ -309,9 +309,8 @@ class InvalidAttckOrMbcTechnique(Lint):
|
||||
with data_path.open("rb") as fd:
|
||||
self.data = json.load(fd)
|
||||
self.enabled_frameworks = self.data.keys()
|
||||
except BaseException:
|
||||
# If linter-data.json is not present, or if an error happen
|
||||
# we log an error and lint nothing.
|
||||
except (FileNotFoundError, json.decoder.JSONDecodeError):
|
||||
# linter-data.json missing, or JSON error: log an error and skip this lint
|
||||
logger.warning(
|
||||
"Could not load 'scripts/linter-data.json'. The att&ck and mbc information will not be linted."
|
||||
)
|
||||
|
||||
@@ -178,11 +178,8 @@ def main(args: argparse.Namespace) -> None:
|
||||
data["mbc"] = MbcExtractor().run()
|
||||
|
||||
logging.info("Writing results to %s", args.output)
|
||||
try:
|
||||
with Path(args.output).open("w", encoding="utf-8") as jf:
|
||||
json.dump(data, jf, indent=2)
|
||||
except BaseException as e:
|
||||
logging.error("Exception encountered when writing results: %s", e)
|
||||
with Path(args.output).open("w", encoding="utf-8") as jf:
|
||||
json.dump(data, jf, indent=2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user