Skip to content

Commit 9f0296e

Browse files
committed
fix(v1-contexts): Returning undefined instead of throwing error if unknown method was requested
1 parent f59c869 commit 9f0296e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/v1-contexts/src/remote.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,19 @@ export const defineActions = <ID extends string, S extends ActionSchema>(
109109
return (new Proxy({}, {
110110
get(_, name) {
111111
if (!(name in schema)) {
112-
throw new Error(`[crm:embed:remote] Invokable ${String(name)} is not present in schema ${id}`)
112+
return undefined
113113
}
114114

115115
const { accepts, expects } = schema[name as keyof S]
116116

117117
return async (...args: unknown[]) => {
118118
if (!accepts(args)) {
119-
throw new Error(`[crm:embed:remote] Invalid arguments for invokable ${String(name)}`)
119+
throw new Error(`[crm:embed:remote] Invalid arguments for invokable ${String(name)} in schema ${id}`)
120120
}
121121

122122
const result = await endpoint.call.invoke(String(name), ...args)
123123
if (!expects(result)) {
124-
throw new Error(`[crm:embed:remote] Invalid result for invokable ${String(name)}`)
124+
throw new Error(`[crm:embed:remote] Invalid result for invokable ${String(name)} in schema ${id}`)
125125
}
126126

127127
return result

0 commit comments

Comments
 (0)