s = "\u{d800}"
produces an error, test.rb:1: invalid Unicode codepoint
, as expected. However,
begin
s = "\u{d800}"
rescue Exception
puts "oh no"
end
does the same thing, producing the error rather than an output of oh no
. Is there a built-in way to rescue this, or would I have to hardcode valid ranges of Unicode codepoints to check validity?