Skip to content

Commit

Permalink
Extend informational output when encountering a problem in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
gettalong committed Nov 2, 2024
1 parent bec87ad commit 3da3b7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased

### Changed

* Informational output on errors when running CLI commands to provide more
details

### Fixed

* Parsing of indirect objects the value of which is an indirect reference
Expand Down
15 changes: 14 additions & 1 deletion lib/hexapdf/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,21 @@ def self.run(args = ARGV)
rescue StandardError => e
$stderr.puts "Problem encountered: #{e.message}"
unless e.kind_of?(HexaPDF::Error)
$stderr.puts "Backtrace (last 10 lines):"
$stderr.puts e.backtrace[0, 10]
$stderr.puts
$stderr.puts "--> The problem might indicate a faulty PDF or a bug in HexaPDF."
$stderr.puts "--> Please report this at https://github.com/gettalong/hexapdf/issues - thanks!"
$stderr.puts "--> Please report this at"
$stderr.puts "-->"
$stderr.puts "--> https://github.com/gettalong/hexapdf/issues"
$stderr.puts "-->"
$stderr.puts "--> and include the information above as well as the output of running"
$stderr.puts "--> the following command on the input PDF:"
$stderr.puts "-->"
$stderr.puts "--> hexapdf info --check INPUT.PDF"
$stderr.puts "-->"
$stderr.puts "--> If possible, please also provide the input PDF."
$stderr.puts "--> Thanks!"
end
exit(1)
end
Expand Down

0 comments on commit 3da3b7a

Please sign in to comment.