GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BREAKING: Raise GMTTypeError exception for invalid types. Previously raise GMTInvalidInput by seisman · Pull Request #3999 · GenericMappingTools/pygmt

Conversation

@seisman

@seisman seisman commented Jul 15, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Following PR #3985. Addressing #3707 and #3984.

This PR adds a new exception GMTTypeError. The error message is like:

Unrecognized data type: xxxx. Explain the reason.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
seisman added 2 commits July 15, 2025 11:24
@seisman
Add the GMTTypeError exception
a9b0363
@seisman
Use GMTTypeError exception
62041f0
@seisman seisman added this to the 0.17.0 milestone Jul 15, 2025
@seisman seisman added the enhancement Improving an existing feature label Jul 15, 2025
seisman added 4 commits July 15, 2025 11:39
@seisman
Fix some tests
d68a0cb
@seisman
Fix more tests
5cdb38e
@seisman
Fix a typo
74c632f
@seisman
Fix a typo
f5e44c4
@seisman
seisman requested a review from Copilot July 15, 2025 06:02
@seisman seisman added the needs review This PR has higher priority and needs review. label Jul 15, 2025
@seisman
seisman marked this pull request as ready for review July 15, 2025 06:02
Copilot AI reviewed Jul 15, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the handling of invalid-type inputs by introducing and raising a new exception class GMTTypeError instead of GMTInvalidInput. Tests across many modules have been updated to expect GMTTypeError, and source files for core commands have been modified to import and raise the new exception. Additionally, the GMTTypeError class has been added to pygmt/exceptions.py.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pygmt/exceptions.py Added GMTTypeError subclass of TypeError for invalid input types
pygmt/src/x2sys_cross.py Switched invalid-type error from GMTInvalidInput to GMTTypeError
pygmt/src/text.py Updated array‐argument checks to raise GMTTypeError
pygmt/src/plot3d.py Changed invalid‐array errors to raise GMTTypeError
pygmt/src/plot.py Changed invalid‐array errors to raise GMTTypeError
pygmt/src/legend.py Changed invalid‐type checks to raise GMTTypeError
pygmt/src/grdcut.py Switched unsupported‐type error to GMTTypeError
pygmt/clib/session.py Replaced several GMTInvalidInput raises with GMTTypeError, and updated docstrings
pygmt/tests/* Updated tests to import and expect GMTTypeError instead of GMTInvalidInput

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pygmt/tests/test_plot3d.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_plot.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_grdtrack.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_grdimage.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_grd2cpt.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_clib_put_vector.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

michaelgrund
michaelgrund approved these changes Jul 15, 2025
View reviewed changes
seisman added 4 commits July 15, 2025 16:18
@seisman
Add to API doc
bc3edef
@seisman
Merge branch 'main' into exception/typeerror
30a27af
@seisman
Update velo
a88e9db
@seisman
Merge branch 'main' into exception/typeerror
76bbca5
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Jul 21, 2025
@seisman

seisman commented Jul 21, 2025

Copy link
Copy Markdown
Member Author

Ping @GenericMappingTools/pygmt-maintainers for final reivews. I plan to merge in 48 hours.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jul 10, 2025
Add new exceptions for invalid inputs and deprecate GMTInvalidInput exception #3707
Open
Add new exception GMTParameterError for invalid parameters #4003
Closed
weiji14
weiji14 approved these changes Jul 21, 2025
View reviewed changes
yvonnefroehlich
yvonnefroehlich approved these changes Jul 21, 2025
View reviewed changes

@yvonnefroehlich yvonnefroehlich left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with the changes, just a few minor suggestions and comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread doc/api/index.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/clib/session.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/text.py Outdated
raise GMTInvalidInput(msg)
raise GMTTypeError(
type(arg),
reason=f"Parameter {name!r} expects a scalar value or True.",

@yvonnefroehlich yvonnefroehlich Jul 21, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With "scalar value", we refer to a float, or?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seisman seisman Jul 21, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it back to "single".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
seisman
seisman commented Jul 21, 2025
View reviewed changes
Comment thread pygmt/src/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@seisman @yvonnefroehlich
Apply suggestions from code review
f7018b2
Co-authored-by: Yvonne Fröhlich <[email protected]>
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Jul 21, 2025
@seisman

seisman commented Jul 21, 2025

Copy link
Copy Markdown
Member Author

/format

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman
Fix styling
9248e9c
@seisman
seisman merged commit eddc912 into main Jul 21, 2025
@seisman
seisman deleted the exception/typeerror branch July 21, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@michaelgrund michaelgrund michaelgrund approved these changes
@weiji14 weiji14 weiji14 approved these changes
@yvonnefroehlich yvonnefroehlich yvonnefroehlich approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement Improving an existing feature

Projects

None yet

Milestone

0.17.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@seisman @michaelgrund @weiji14 @yvonnefroehlich
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.