Show More
@@ -60,7 +60,7 b' from IPython.core.magic_arguments import (' | |||
|
60 | 60 | ) |
|
61 | 61 | from IPython.utils.py3compat import str_to_unicode, unicode_to_str, PY3 |
|
62 | 62 | |
|
63 |
class R |
|
|
63 | class RInterpreterError(ri.RRuntimeError): | |
|
64 | 64 | """An error when running R code in a %%R magic cell.""" |
|
65 | 65 | def __init__(self, line, err, stdout): |
|
66 | 66 | self.line = line |
@@ -68,7 +68,7 b' class RMagicError(ri.RRuntimeError):' | |||
|
68 | 68 | self.stdout = stdout.rstrip() |
|
69 | 69 | |
|
70 | 70 | def __unicode__(self): |
|
71 |
s = 'Failed to parse and evaluate line |
|
|
71 | s = 'Failed to parse and evaluate line %r.\nR error message: %r' % \ | |
|
72 | 72 | (self.line, self.err) |
|
73 | 73 | if self.stdout and (self.stdout != self.err): |
|
74 | 74 | s += '\nR stdout:\n' + self.stdout |
@@ -158,7 +158,7 b' class RMagics(Magics):' | |||
|
158 | 158 | value = ri.baseenv['eval'](ri.parse(line)) |
|
159 | 159 | except (ri.RRuntimeError, ValueError) as exception: |
|
160 | 160 | warning_or_other_msg = self.flush() # otherwise next return seems to have copy of error |
|
161 |
raise R |
|
|
161 | raise RInterpreterError(line, str_to_unicode(str(exception)), warning_or_other_msg) | |
|
162 | 162 | text_output = self.flush() |
|
163 | 163 | ri.set_writeconsole(old_writeconsole) |
|
164 | 164 | return text_output, value |
General Comments 0
You need to be logged in to leave comments.
Login now