Skip to content

Commit 0456681

Browse files
committed
Make error_location optional
1 parent 1e95bbf commit 0456681

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

trino/exceptions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ def message(self) -> str:
108108
return self._error.get("message", "Trino did not return an error message")
109109

110110
@property
111-
def error_location(self) -> Tuple[int, int]:
112-
location = self._error["errorLocation"]
113-
return (location["lineNumber"], location["columnNumber"])
111+
def error_location(self) -> Optional[Tuple[int, int]]:
112+
location = self._error.get("errorLocation", None)
113+
return (location["lineNumber"], location["columnNumber"]) if location else None
114114

115115
@property
116116
def query_id(self) -> Optional[str]:

0 commit comments

Comments
 (0)