Skip to content

Conversation

@ernstwi
Copy link

@ernstwi ernstwi commented Mar 11, 2025

Problem: If fetchFn returns an error, we still attempt an unwrap and ErrInvalidType is (most likely) returned here. The original error is not logged, which causes problems in observability.

Proposed solution: Don't attempt to unwrap if fetchFn returns an error, instead return that error immediately.

Alternative solution: Another option could be to still attempt the unwrap, but do an errors.Join with the original error like in #33 if the type assertion fails. But I don't think this makes as much sense.

Not tested yet, but opening a PR to see what you think. Maybe there are some tests which should also be updated?

@viccon
Copy link
Owner

viccon commented Mar 12, 2025

Hi @ernstwi , I did a quick test and can confirm that this is an issue. However, I think the fix for this is going to be a little more complex. I'll try to find some time for this soon!

@ernstwi
Copy link
Author

ernstwi commented Mar 12, 2025

OK, thanks! Let me know if I can help, otherwise I'll leave it to you then.

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