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

False positive FES warning for loadModel(path, callback)

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

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

该警告来自 Friendly Error System 对 loadModel() 的参数检查。请从那里开始,找到将第二个参数期望为字符串的分支。将其与 PR #9286 中的修复进行比较,该修复处理了 loadModel(path, true),并使回调形式通过相同的检查。完成标准是:传入有效回调的 loadModel(path, callback) 不输出任何 FES 警告,并且 loadModel(path, true) 的行为与之前保持一致。

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

描述

p5.js 2.0+
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.4

Web browser and version

Google Chrome 155.0.8059.40 (Official Build) (64-bit)

Operating system

Windows 11 Version 25H2 (Build 26200.9457)

Steps to reproduce this
Steps:
  1. Open the p5.js Web Editor.
  2. Upload a valid teapot.obj file into an assets folder in the sketch.
  3. Run the following sketch and check the console.
Snippet:
let teapot;

function setup() {
  createCanvas(400, 400, WEBGL);

  loadModel("/assets/teapot.obj", function (modelData) {
    teapot = modelData;
    console.log("Model loaded successfully:", modelData);
  });
}

function draw() {
  background(220);
  orbitControl();
  normalMaterial();

  if (teapot) {
    scale(2);
    model(teapot);
  }
}
Expected behavior

Calling loadModel(path, callback) with a valid callback should not produce a Friendly Error System (FES) warning.

Actual behavior

The model loads and renders successfully, and the callback executes. However, FES reports:

p5.js says: Expected string at the second parameter in loadModel().

This appears to be a false positive because the callback is a valid second argument for this overload.

Additional context

This is a follow-up to Issue #9176 and it's fix PR #9286 , which addressed the false-positive FES warning for loadModel(path, true).

The callback overload loadModel(path, callback) still produces a similar warning after that fix. I reproduced this behavior in the p5.js Web Editor using a local OBJ file.

I'd like to work on this issue if approved. Could a maintainer please review it and assign it to me if appropriate?

Screenshot of Issue Visually
Image
主要语言
JavaScript
星标
24.1k
派生
3.9k
平均合并
3 天 43 分钟
30 天内合并 PR
33

环境准备

从这里开始

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

processing/p5.js 的其他 Issue

查看 processing/p5.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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