You intended to write as rescue StandardError
. However, you have written rescue => StandardError
.
In that case, the result of rescue
will overwrite StandardError
.
begin
something
rescue => StandardError
end
begin
something
rescue StandardError
end