@@ -79,23 +79,20 @@ export class K8sDomain extends Domain {
7979 throw this . badQuery ( query , e . message ) ;
8080 }
8181 const m = query . class . name . match ( / ^ ( [ ^ . ] + ) (?: \. ( [ ^ . ] * ) (?: \. ( .* ) ) ? ) ? $ / ) ?? [ ] ;
82- if ( ! m ) throw this . badQuery ( query ) ;
82+ if ( ! m ) throw this . badQuery ( query , "incorrect format" ) ;
8383 let model = findGVK ( m [ 3 ] , m [ 2 ] , m [ 1 ] ) ;
84- if ( ! model ) throw this . badQuery ( query ) ;
84+ if ( ! model ) throw this . badQuery ( query , "no matching resource" ) ;
8585 let namespace = data . namespace ;
8686 let name = data . name ;
8787 let events = '' ;
8888 if ( isEvent ( model ) ) {
8989 // Special treatment for event objects: focus on the involved object, not the event.
9090 events = '/events' ;
9191 const about = eventAboutField ( model ) ;
92- model = findGVK (
93- data . fields [ `${ about } .apiGroup` ] ,
94- data . fields [ `${ about } .apiVersion` ] ,
95- data . fields [ `${ about } .kind` ] ,
96- ) ;
97- if ( ! model )
98- throw this . badQuery ( query , `no resource for '${ about } ' field in ${ query . selector } ` ) ;
92+ const [ group , version ] = data . fields [ `${ about } .apiVersion` ] ?. split ( "/" ) ?? [ ]
93+ const kind = data . fields [ `${ about } .kind` ]
94+ model = findGVK ( group , version , kind )
95+ if ( ! model ) throw this . badQuery ( query , `no resource for group=${ group } version=${ version } kind=${ kind } ` ) ;
9996 namespace = data . fields [ `${ about } .namespace` ] || '' ;
10097 name = data . fields [ `${ about } .name` ] || '' ;
10198 }
0 commit comments