File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -74,13 +74,13 @@ interface ParsedRegistryKey {
74
74
* - /prompt/my-plugin/folder/my-prompt
75
75
* - /util/generate
76
76
*/
77
- export function parseRegistryKey ( registryKey : string ) : ParsedRegistryKey {
77
+ export function parseRegistryKey (
78
+ registryKey : string
79
+ ) : ParsedRegistryKey | undefined {
78
80
const tokens = registryKey . split ( '/' ) ;
79
81
if ( tokens . length < 3 ) {
80
- throw new GenkitError ( {
81
- status : 'INVALID_ARGUMENT' ,
82
- message : `invalid action key format: ${ registryKey } ` ,
83
- } ) ;
82
+ // Invalid key format
83
+ return undefined ;
84
84
}
85
85
// ex: /model/googleai/gemini-2.0-flash or /prompt/my-plugin/folder/my-prompt
86
86
if ( tokens . length >= 4 ) {
@@ -152,7 +152,7 @@ export class Registry {
152
152
> ( key : string ) : Promise < R > {
153
153
// We always try to initialize the plugin first.
154
154
const parsedKey = parseRegistryKey ( key ) ;
155
- if ( parsedKey . pluginName && this . pluginsByName [ parsedKey . pluginName ] ) {
155
+ if ( parsedKey ? .pluginName && this . pluginsByName [ parsedKey . pluginName ] ) {
156
156
await this . initializePlugin ( parsedKey . pluginName ) ;
157
157
158
158
// If we don't see the key in the registry, we try to resolve
You can’t perform that action at this time.
0 commit comments