feat: unified error type (#308)
* feat: unified error type * fix: use type id to compare transport type
This commit is contained in:
parent
c74b26b3e3
commit
e615300fea
1 changed files with 286 additions and 161 deletions
|
|
@ -52,7 +52,7 @@ impl<S: Send + Sync + 'static> ToolRoute<S> {
|
|||
where
|
||||
C: for<'a> Fn(
|
||||
ToolCallContext<'a, S>,
|
||||
) -> BoxFuture<'a, Result<CallToolResult, crate::Error>>
|
||||
) -> BoxFuture<'a, Result<CallToolResult, crate::ErrorData>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
|
|
@ -237,11 +237,11 @@ where
|
|||
pub async fn call(
|
||||
&self,
|
||||
context: ToolCallContext<'_, S>,
|
||||
) -> Result<CallToolResult, crate::Error> {
|
||||
) -> Result<CallToolResult, crate::ErrorData> {
|
||||
let item = self
|
||||
.map
|
||||
.get(context.name())
|
||||
.ok_or_else(|| crate::Error::invalid_params("tool not found", None))?;
|
||||
.ok_or_else(|| crate::ErrorData::invalid_params("tool not found", None))?;
|
||||
(item.call)(context).await
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue