You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background oras.Copy is consisted of several different operations. To add more context to the returned error, current implementation is to wrap a description string over the error, e.g. when resolving the source artifact fails, below string will be added to wrap the original error:
return ocispec.Descriptor{}, fmt.Errorf("failed to resolve %s: %w", srcRef, err)
Problem
This method imposes below challenges when processing the obtained error:
string context are hard to process: taking the above error as an example, it's hard to extract out the added context failed to resolve $srcRef out elegantly from caller side
lack information of where the error happens: an error might happens on source target or destination target, it's not reflected in the added context
Solution
Adding a structured error type for error returned by oras.Copy like below
typeCopyErrorstruct {
// represents the failing operation, e.g. resolveOpstring// represents where it failsOnstring// enumerable string, source or dest// Inner errorErrerror
}
The text was updated successfully, but these errors were encountered:
qweeah
changed the title
add error type for oras.Copy
add error type return by oras.Copy
Jan 11, 2024
Background
oras.Copy
is consisted of several different operations. To add more context to the returned error, current implementation is to wrap a description string over the error, e.g. when resolving the source artifact fails, below string will be added to wrap the original error:oras-go/copy.go
Line 138 in f296072
Problem
This method imposes below challenges when processing the obtained error:
failed to resolve $srcRef
out elegantly from caller sideSolution
Adding a structured error type for error returned by
oras.Copy
like belowThe text was updated successfully, but these errors were encountered: