Skip to content

Commit

Permalink
Merge pull request #198 from CycloneDX/verbose_outout_errors
Browse files Browse the repository at this point in the history
fix: improved output errors - file/directory is now included
  • Loading branch information
madpah committed Mar 28, 2022
2 parents 6ccb637 + bfe8fb1 commit 4618c62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cyclonedx/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def output_to_file(self, filename: str, allow_overwrite: bool = False) -> None:
output_directory = os.path.dirname(output_filename)

if not os.access(output_directory, os.W_OK):
raise PermissionError
raise PermissionError(output_directory)

if os.path.exists(output_filename) and not allow_overwrite:
raise FileExistsError
raise FileExistsError(output_filename)

with open(output_filename, mode='wb') as f_out:
f_out.write(self.output_as_string().encode('utf-8'))
Expand Down

0 comments on commit 4618c62

Please sign in to comment.