99from pygmt ._typing import AnchorCode , PathLike , StringArrayTypes , TableLike
1010from pygmt .alias import Alias , AliasSystem
1111from pygmt .clib import Session
12- from pygmt .exceptions import GMTInvalidInput , GMTParameterError , GMTTypeError
12+ from pygmt .exceptions import GMTParameterError , GMTTypeError
1313from pygmt .helpers import (
1414 _check_encoding ,
1515 build_arg_list ,
3434 it = "use_word" ,
3535 w = "wrap" ,
3636)
37- def text_ ( # noqa: PLR0912, PLR0913, PLR0915
37+ def text_ ( # noqa: PLR0912, PLR0913
3838 self ,
3939 textfiles : PathLike | TableLike | None = None ,
4040 x = None ,
@@ -191,8 +191,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915
191191 + (position is not None )
192192 + (x is not None or y is not None )
193193 ) != 1 :
194- msg = "Provide either 'textfiles', 'x'/'y'/'text', or 'position'/'text'."
195- raise GMTInvalidInput (msg )
194+ raise GMTParameterError (at_most_one = {"textfiles" , "x/y/text" , "position/text" })
196195
197196 data_is_required = position is None
198197 kind = data_kind (textfiles , required = data_is_required )
@@ -209,8 +208,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915
209208 )
210209
211210 if textfiles is not None and text is not None :
212- msg = "'text' can't be specified when 'textfiles' is given."
213- raise GMTInvalidInput (msg )
211+ raise GMTParameterError (at_most_one = {"textfiles" , "text" })
214212 if kind == "empty" and text is None :
215213 raise GMTParameterError (
216214 required = "text" , reason = "Required when 'x' and 'y' are set."
0 commit comments