Skip to content

Commit a30e84f

Browse files
committed
Expose the error details field.
Error details get exposed as `_details` property.
1 parent ca40114 commit a30e84f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

edgedb/errors/_base.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ def _hint(self):
125125
# not a stable API method
126126
return self._read_str_field(FIELD_HINT)
127127

128+
@property
129+
def _details(self):
130+
# not a stable API method
131+
return self._read_str_field(FIELD_DETAILS)
132+
128133
def _read_str_field(self, key, default=None):
129134
val = self._attrs.get(key)
130135
if val:
@@ -156,6 +161,7 @@ def __str__(self):
156161
self._line if self._line > 0 else "?",
157162
self._col if self._col > 0 else "?",
158163
self._hint or "error",
164+
self._details,
159165
)
160166
except Exception:
161167
return "".join(
@@ -226,7 +232,7 @@ def _severity_name(severity):
226232
return 'PANIC'
227233

228234

229-
def _format_error(msg, query, start, offset, line, col, hint):
235+
def _format_error(msg, query, start, offset, line, col, hint, details):
230236
c = get_color()
231237
rv = io.StringIO()
232238
rv.write(f"{c.BOLD}{msg}{c.ENDC}{LINESEP}")
@@ -278,6 +284,10 @@ def _format_error(msg, query, start, offset, line, col, hint):
278284
rv.write(f"{c.BLUE}{'':>{num_len}} │ "
279285
f"{c.FAIL}╰─{'─' * (size - 1)}^ {hint}{c.ENDC}")
280286
break
287+
288+
if detials:
289+
rv.write(f"{LINESEP}Details: {details}")
290+
281291
return rv.getvalue()
282292

283293

0 commit comments

Comments
 (0)