Skip to content

Commit

Permalink
Merge pull request #174 from yast/invalid-byte-sequence-in-utf8-m
Browse files Browse the repository at this point in the history
Rescue "invalid byte sequence in UTF-8", with a custom message (master)
  • Loading branch information
mvidner committed Sep 16, 2016
2 parents e41a0a1 + f99dfb7 commit a4c65f6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions package/yast2-ruby-bindings.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Sep 16 10:28:16 UTC 2016 - mvidner@suse.com

- Rescue "invalid byte sequence in UTF-8", with a custom message
(bsc#992821).
- 3.1.51

-------------------------------------------------------------------
Thu Jun 30 09:24:32 UTC 2016 - jreidinger@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-ruby-bindings.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-ruby-bindings
Version: 3.1.50
Version: 3.1.51
Url: https://github.com/yast/yast-ruby-bindings
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
13 changes: 10 additions & 3 deletions src/ruby/yast/wfm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,16 @@ def self.ask_to_run_debugger?
# @param [Exception] e the caught exception
# @return [String] human readable exception description
def self.internal_error_msg(e)
"Internal error. Please report a bug report with logs.\n" \
"Details: #{e.message}\n" \
"Caller: #{e.backtrace.first}"
msg = "Internal error. Please report a bug report with logs.\n"

if e.is_a?(ArgumentError) && e.message =~ /invalid byte sequence in UTF-8/
msg += "A string was encountered that is not valid in UTF-8.\n" \
"The system encoding is #{Encoding.locale_charmap.inspect}.\n" \
"Refer to https://www.suse.com/support/kb/doc?id=7018056.\n\n"
end

msg + "Details: #{e.message}\n" \
"Caller: #{e.backtrace.first}"
end

# @private wrapper to run client in ruby
Expand Down

0 comments on commit a4c65f6

Please sign in to comment.