|
10 | 10 | from pygmt._typing import PathLike |
11 | 11 | from pygmt.alias import Alias, AliasSystem |
12 | 12 | from pygmt.clib import Session, __gmt_version__ |
13 | | -from pygmt.exceptions import GMTInvalidInput, GMTParameterError |
| 13 | +from pygmt.exceptions import GMTParameterError |
14 | 14 | from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias |
15 | 15 | from pygmt.src.grdinfo import grdinfo |
16 | 16 |
|
@@ -80,17 +80,20 @@ def _alias_option_Q( # noqa: N802 |
80 | 80 | ) |
81 | 81 |
|
82 | 82 | if dpi is not None and surftype != "image": |
83 | | - msg = "Parameter 'dpi' can only be used when 'surftype' is 'image'." |
84 | | - raise GMTInvalidInput(msg) |
| 83 | + raise GMTParameterError( |
| 84 | + conflicts_with=("dpi", [f"surftype={surftype!r}"]), |
| 85 | + reason="'dpi' is allowed only when 'surftype' is 'image'.", |
| 86 | + ) |
85 | 87 | if nan_transparent and surftype != "image": |
86 | | - msg = "Parameter 'nan_transparent' can only be used when 'surftype' is 'image'." |
87 | | - raise GMTInvalidInput(msg) |
| 88 | + raise GMTParameterError( |
| 89 | + conflicts_with=("nan_transparent", [f"surftype={surftype!r}"]), |
| 90 | + reason="'nan_transparent' is allowed only when 'surftype' is 'image'.", |
| 91 | + ) |
88 | 92 | if mesh_fill is not None and surftype not in {"mesh", "waterfall_x", "waterfall_y"}: |
89 | | - msg = ( |
90 | | - "Parameter 'mesh_fill' can only be used when 'surftype' is 'mesh', " |
91 | | - "'waterfall_x', or 'waterfall_y'." |
| 93 | + raise GMTParameterError( |
| 94 | + conflicts_with=("mesh_fill", [f"surftype={surftype!r}"]), |
| 95 | + reason="'mesh_fill' is allowed only when 'surftype' is 'mesh', 'waterfall_x', or 'waterfall_y'.", |
92 | 96 | ) |
93 | | - raise GMTInvalidInput(msg) |
94 | 97 |
|
95 | 98 | return [ |
96 | 99 | Alias( |
|
0 commit comments