Indicate fetch errors on sources
See original GitHub issueAs a user, I want to quickly tell whether there’s problems fetching from some source, and quickly see what the error message is.
Sources may run into problems trying to connect or fetch revisions. Following VS Code Extension guidelines, provide a quick visual cue to users if a source has entered a problem state, and allow the user quick access to see the error message (again following extension best practices, whether tooltip or otherwise.
A source will be in a problem state when the attribute status.conditions[0].status is False and the information required to be shown for error message is status.conditions[0].message and status.conditions[0].reason
Please refer to #40 for details on how to query for the payload below.
kubectl get gitrepository sample-k8s-not -o yaml
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"source.toolkit.fluxcd.io/v1beta1","kind":"GitRepository","metadata":{"annotations":{},"name":"sample-k8s-not","namespace":"default"},"spec":{"interval":"1m","ref":{"branch":"main"},"url":"https://github.com/murillodigital/sample-k8s-not"}}
creationTimestamp: "2021-08-31T20:03:41Z"
finalizers:
- finalizers.fluxcd.io
generation: 2
name: sample-k8s-not
namespace: default
resourceVersion: "1318400"
uid: 7b5c3be3-6028-4af0-86ec-70eecc76720e
spec:
gitImplementation: go-git
interval: 1m0s
ref:
branch: main
timeout: 20s
url: https://github.com/murillodigital/sample-k8s-not
status:
conditions:
- lastTransitionTime: "2021-08-31T20:03:52Z"
message: 'unable to clone ''https://github.com/murillodigital/sample-k8s-not'',
error: authentication required'
reason: GitOperationFailed
status: "False"
type: Ready
observedGeneration: 2
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
When That's Not So Fetch: Error Handling With fetch()
The fetch API provides an ok property to the Promise response which indicates whether the HTTP status is within the range 200-299 (inclusive)....
Read more >Error handling while using native fetch API in JavaScript
We will see, how to handle fetch API errors using promises and async await syntax in JavaScript.
Read more >How to Investigate Fetch API Errors - Noibu - Knowledge Base
Open that URL in another tab, and examine the source code through same process used when No JavaScript File is Detected. Learn more...
Read more >fetch() - Web APIs | MDN
A fetch() promise only rejects when a network error is encountered (which is usually when there's a permissions issue or similar). A fetch() ......
Read more >How to Use the Fetch API (Correctly) - CODE Magazine
In the . catch() method, call a method named displayError() that can display an error message in the error label.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sources show error status now:
If you want them to have other icons in the future we can use emoji ❌
For reference, here’s a few examples on Flux’s documentation as to how these status may look:
https://fluxcd.io/docs/components/source/gitrepositories/#status-examples https://fluxcd.io/docs/components/source/helmrepositories/#status-examples https://fluxcd.io/docs/components/source/buckets/#status-examples
Note that the data will vary but structure will be identical, there will always be a single condition (always grab
status.conditions[0]) - the information in this object is what a user will find most valuable during troubleshooting a failed reconciliation.