Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

TS SDK: failed procedure calls reject with a bare string instead of an Error

未关闭 适合新手
#6,288 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Tyagiquamar 已经在做这个了。

开始于 2026年10月21日。

  • #6349 来自 @Tyagiquamar —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
devtools

调研方向

从 crates/bindings-typescript/src/sdk/db_connection_impl.ts 开始,查看 #callProcedureWithEncodedName 和 #callProcedureGeneric 的 procedure 回调,其中失败分支直接以原始的 result.value 字符串拒绝。与同一文件中的 reducer 路径进行比较,后者会将该值包装在 Error 子类中。完成标准是:两条 procedure 路径都以携带相同消息的 Error 拒绝,并且对失败的 procedure 调用进行的 Jest rejects.toThrow 检查通过。

由索引模型根据 Issue 内容生成。

描述

Version: spacetimedb npm 2.11.0 and 2.12.0; still present on master (1b67ca3).

Where: crates/bindings-typescript/src/sdk/db_connection_impl.ts, the procedure callbacks in #callProcedureWithEncodedName and #callProcedureGeneric:

if (result.tag === 'Ok') {
  resolve(result.value);
} else {
  reject(result.value); // a plain string
}

Reducer calls in the same file reject with new InternalError(result.value) (or SenderError), so await conn.reducers.x(...) always rejects with an Error, but await conn.procedures.x(...) rejects with a bare string when the host fails the call (for example invalid arguments for procedure ...: data too short ... after a module republish changes a parameter type).

Effect:

  • No stack trace, and error instanceof Error checks treat it as unknown.
  • Jest's await expect(p).rejects.toThrow(...) reports "Received function did not throw" for a rejected procedure call.

Suggested fix: reject with new InternalError(result.value) in both procedure callbacks, matching the reducer path.

主要语言
Rust
星标
25.3k
派生
1.1k
平均合并
2 天 23 小时
30 天内合并 PR
67

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

clockworklabs/SpacetimeDB 的其他 Issue

查看 clockworklabs/SpacetimeDB 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。