Skip to content

Commit f060923

Browse files
committed
fix
1 parent 73a1b65 commit f060923

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

js/core/src/registry.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ interface ParsedRegistryKey {
7474
* - /prompt/my-plugin/folder/my-prompt
7575
* - /util/generate
7676
*/
77-
export function parseRegistryKey(registryKey: string): ParsedRegistryKey {
77+
export function parseRegistryKey(
78+
registryKey: string
79+
): ParsedRegistryKey | undefined {
7880
const tokens = registryKey.split('/');
7981
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;
8484
}
8585
// ex: /model/googleai/gemini-2.0-flash or /prompt/my-plugin/folder/my-prompt
8686
if (tokens.length >= 4) {
@@ -152,7 +152,7 @@ export class Registry {
152152
>(key: string): Promise<R> {
153153
// We always try to initialize the plugin first.
154154
const parsedKey = parseRegistryKey(key);
155-
if (parsedKey.pluginName && this.pluginsByName[parsedKey.pluginName]) {
155+
if (parsedKey?.pluginName && this.pluginsByName[parsedKey.pluginName]) {
156156
await this.initializePlugin(parsedKey.pluginName);
157157

158158
// If we don't see the key in the registry, we try to resolve

0 commit comments

Comments
 (0)