Skip to content

Log import objects error#1977

Merged
petebankhead merged 1 commit intoqupath:mainfrom
Rylern:log-import-objects-error
Aug 22, 2025
Merged

Log import objects error#1977
petebankhead merged 1 commit intoqupath:mainfrom
Rylern:log-import-objects-error

Conversation

@Rylern
Copy link
Contributor

@Rylern Rylern commented Aug 21, 2025

Log import objects error. Before this PR, only exception.getLocalizedMessage() was shown.

@Rylern Rylern requested a review from petebankhead August 21, 2025 12:51
@petebankhead
Copy link
Member

Looks good. For reference, this refers to https://forum.image.sc/t/error-on-geojson-object-import-in-qupath/115968

The lack of logging info depends upon how the import was performed.
Previously, the full stack trace was already logged as an error when using drag & drop, or when trying to import the GeoJSON with a script like this:

var json = """
{
    "features": [
        {
            "geometry": {
                "coordinates": [
                    [
                        [
                            36321,
                            40303
                        ],
                        [
                            36270,
                            40238
                        ],
                        [
                            36191,
                            40223
                        ],
                        [
                            36103,
                            40237
                        ],
                        [
                            36102,
                            40380
                        ],
                        [
                            36121,
                            40422
                        ],
                        [
                            36241,
                            40423
                        ],
                        [
                            36312,
                            40284
                        ],
                        [
                            36321,
                            40303
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            "type": "Feature"
        }
    ],
    "type": "FeatureCollection"
}
"""

GsonTools.parseObjectsFromGeoJSON(json)

This PR improves this by logging the error when using File → Import objects from file....

@petebankhead petebankhead merged commit 3e91ae3 into qupath:main Aug 22, 2025
3 checks passed
@Rylern Rylern deleted the log-import-objects-error branch August 27, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants