@@ -58,6 +58,10 @@ var providerFlags = []cli.Flag{
5858 Name : "distance" ,
5959 Usage : "Calculate distance from last seen advertisement to provider's current head advertisement" ,
6060 },
61+ & cli.BoolFlag {
62+ Name : "error" ,
63+ Usage : "Only show providers that have a LastError" ,
64+ },
6165 & cli.BoolFlag {
6266 Name : "id-only" ,
6367 Usage : "Only show provider's peer ID" ,
@@ -208,10 +212,14 @@ func listProviders(cctx *cli.Context, peerIDs []peer.ID) error {
208212 return nil
209213 }
210214
215+ onlyWithError := cctx .Bool ("error" )
211216 for _ , pinfo := range provs {
212217 if _ , ok := exclude [pinfo .AddrInfo .ID ]; ok {
213218 continue
214219 }
220+ if onlyWithError && pinfo .LastError == "" {
221+ continue
222+ }
215223 showProviderInfo (cctx , pinfo )
216224 }
217225
@@ -250,6 +258,11 @@ func showProviderInfo(cctx *cli.Context, pinfo *model.ProviderInfo) {
250258 fmt .Println (" Inactive: true" )
251259 }
252260
261+ if pinfo .LastError != "" {
262+ fmt .Println (" LastError:" , pinfo .LastError )
263+ fmt .Println (" LastErrorTime:" , pinfo .LastErrorTime )
264+ }
265+
253266 if cctx .Bool ("distance" ) {
254267 fmt .Print (" Distance to head advertisement: " )
255268 dist , err := getLastSeenDistance (cctx , pinfo )
@@ -259,6 +272,8 @@ func showProviderInfo(cctx *cli.Context, pinfo *model.ProviderInfo) {
259272 fmt .Println (dist )
260273 }
261274 }
275+
276+ fmt .Println ()
262277}
263278
264279func getLastSeenDistance (cctx * cli.Context , pinfo * model.ProviderInfo ) (int , error ) {
0 commit comments