Skip to content

tidy(utils): Add printing nested Error objs#2269

Merged
Cobalt0s merged 1 commit into
mainfrom
cobalt0s/utils-print
Nov 11, 2025
Merged

tidy(utils): Add printing nested Error objs#2269
Cobalt0s merged 1 commit into
mainfrom
cobalt0s/utils-print

Conversation

@Cobalt0s
Copy link
Copy Markdown
Contributor

@Cobalt0s Cobalt0s commented Nov 6, 2025

Description

Improves utility code used for printing data structures in live test scripts.
Previously, ListObjectMetadataResult and BatchWriteResult displayed Go errors as {} because Error() wasn't invoked.
Now, Error() is called recursively, ensuring all errors are rendered as strings.

DumpJSON now behaves as a true "universal printer" without modifying the original data.

Live Test

Adding non-existent object name to request Hubspot ObjectMetadata we know that for that object an error will be returned.
As per screenshot the nested error is properly converted to string and thats why it is printed not as {} but as text:
image

Copy link
Copy Markdown
Contributor Author

Cobalt0s commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

@anushat05 anushat05 left a comment

Choose a reason for hiding this comment

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

Did we do any sort of testing for us to verify if this util works as expected? Unit tests is also okay

Copy link
Copy Markdown
Contributor

@anushat05 anushat05 left a comment

Choose a reason for hiding this comment

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

Also, looks like there are some merge conflicts

@Cobalt0s Cobalt0s force-pushed the cobalt0s/utils-print branch from 048821e to 5f920fe Compare November 11, 2025 20:16
@Cobalt0s Cobalt0s requested a review from anushat05 November 11, 2025 20:18
@Cobalt0s Cobalt0s merged commit 3fc2baf into main Nov 11, 2025
6 checks passed
@Cobalt0s Cobalt0s deleted the cobalt0s/utils-print branch November 11, 2025 20:23
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