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

[p5.js 2.0+ Bug Report] : p5.strands error paths dump internals to console before throwing

已关闭 适合新手
#9,310 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

@subhranshudash13-dotcom 已经在做这个了。

开始于 2026年10月20日。

评估

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

调研方向

从src/strands/strands_transpiler.js开始,重点查看报告中第2075行和2099-2101行附近的buildStrandsCallback。复现格式错误的buildMaterialShader回调,并追踪每次抛出异常前的控制台输出。当内部源码和回调细节不再泄露到控制台且错误信息清晰时,即完成;issue未决定是删除日志还是使用友好的错误系统。

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

描述

Area:WebGL p5.js 2.0+ p5.strands
Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
p5.js version

2.3.2 / current main

Web browser and version

Chromium 151

Operating system

MacOS 15.7

Steps to reproduce this
Steps:
  1. I was playing around with buildMaterialShader in WEBGL mode and made a typo in my shader callback (still getting the hang of the strands syntax honestly).
  2. Opened devtools to see what went wrong.
  3. Instead of one clear error, the console first printed a big dump of generated source code, and only then threw Could not parse p5.strands function!. On a different malformed shape I also saw param names and the full body logged before Error transpiling p5.strands callback!.
Snippet:
function setup() {
  createCanvas(200, 200, WEBGL);
  // my callback had a typo in it, wanted to see the error
  let s = buildMaterialShader(() => {
    // malformed shape here
  });
}

What I expected: a single friendly error pointing at what I got wrong in my callback.

What actually happened: internals dumped to the console first via console.log, then the generic throw. I ended up digging through generated code instead of fixing my typo, which was pretty confusing as someone new to shaders.

Where I traced it: src/strands/strands_transpiler.js in buildStrandsCallback, line 2075 (console.log(escodegen.generate(ast))) and lines 2099-2101 (console.error(e); console.log(paramNames); console.log(body)).

One question —

would you prefer these just removed, or routed through the friendly error system with the source location that's already available..?

Happy to follow this approach and happy to go your direction if you think something else fits better here.

主要语言
JavaScript
星标
24.2k
派生
3.9k
平均合并
3 天 2 小时
30 天内合并 PR
35

环境准备

从这里开始

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

processing/p5.js 的其他 Issue

查看 processing/p5.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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