Skip to content

fix: preserve per-reference error context in ClientImage.save() and update callers#1223

Open
meet114 wants to merge 1 commit intoapple:mainfrom
meet114:main
Open

fix: preserve per-reference error context in ClientImage.save() and update callers#1223
meet114 wants to merge 1 commit intoapple:mainfrom
meet114:main

Conversation

@meet114
Copy link

@meet114 meet114 commented Feb 16, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

The ClientImage.save() method had a TODO to improve error handling. Previously, get(names:) returned failed references as plain strings, discarding the underlying error cause (e.g., not found vs. parse failure vs. network error). The save() method then threw a generic .invalidArgument error with no detail about why each reference failed. This made it difficult for users to diagnose and fix issues when saving multiple images. This change introduces ImageLookupError to preserve per-reference error context, updates all callers (save(), ImageInspect, ImageDelete) to use the richer error type, and changes the error code to the more semantically accurate .notFound.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@saehejkang
Copy link
Contributor

These changes aren't inherently wrong and we do need to fix the error handling for most of these functions, but all of this will just add more tech debt.

There is a big transition to update all the resources (image, volume, etc.) to conform to the new ManagedResource type. Furthermore, we are working on revamping error handling/propagation. The changes you made are going to be reworked based on the direction we decide to take in #1126 and #1086.

The discussions and changes have been on the back burner, due to higher priorities. I plan to get them moving again soon, since they should create "good first issues" that new contributors can pick up and work on.

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