Skip to content

Commit

Permalink
Add error handling to address #62. (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdnaneKhan authored Dec 14, 2024
1 parent 69f867c commit 06a7940
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions gatox/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,14 @@ def enumerate(args, parser):
exec_wrapper.add_organizations(orgs)
exec_wrapper.add_repositories(repos)

if args.output_json:
Output.write_json(exec_wrapper, args.output_json)
try:

if args.output_json:
Output.write_json(exec_wrapper, args.output_json)
except Exception as output_error:
Output.error(
"Encountered an error writing the output JSON, this is likely a Gato-X bug."
)


def search(args, parser):
Expand Down
8 changes: 6 additions & 2 deletions gatox/models/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ def toJSON(self):
"enumeration": {
"timestamp": self.timestamp.ctime(),
"organizations": [
organization.toJSON() for organization in self.organizations
organization.toJSON()
for organization in self.organizations
if isinstance(organization, Organization)
],
"repositories": [
repository.toJSON() for repository in self.repositories
organization.toJSON()
for organization in self.organizations
if isinstance(organization, Repository)
],
},
}
Expand Down

0 comments on commit 06a7940

Please sign in to comment.