File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77from pathlib import Path
88from typing import Any , ClassVar , Literal
99
10- from pygmt .exceptions import GMTInvalidInput , GMTValueError
10+ from pygmt .exceptions import GMTInvalidInput , GMTTypeError , GMTValueError
1111from pygmt .params .position import Position
1212from pygmt .src .which import which
1313
@@ -337,7 +337,7 @@ def _parse_position(
337337 ... )
338338 Traceback (most recent call last):
339339 ...
340- pygmt.exceptions.GMTInvalidInput: Invalid type for parameter 'position': ...
340+ pygmt.exceptions.GMTTypeError: Unrecognized data type: <class 'int'>. ...
341341
342342 >>> # Below are examples without kwdict (for new functions).
343343 >>> _parse_position(
@@ -388,6 +388,11 @@ def _parse_position(
388388 case None : # Set default position.
389389 position = default
390390 case _:
391- msg = f"Invalid type for parameter 'position': { type (position )} ."
392- raise GMTInvalidInput (msg )
391+ raise GMTTypeError (
392+ type (position ),
393+ reason = (
394+ "Parameter 'position' must be a Position object, "
395+ "a two-value sequence, a justification code, or None."
396+ ),
397+ )
393398 return position
You can’t perform that action at this time.
0 commit comments