Skip to content

Commit 698a72d

Browse files
committed
improve invariant message
1 parent 615234d commit 698a72d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/createComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ module.exports = function createComponent (renderGLNode, staticFields) {
1111
const glNode = renderGLNode(this.props);
1212

1313
invariant(glNode && glNode.type && (glNode.type.isGLNode || glNode.type.isGLComponent),
14-
"The GL.createComponent function parameter must return a GL.Node or "+
15-
"another GL Component");
14+
"%s: The GL.createComponent function parameter must return a GL.Node or "+
15+
"another GL Component", GLComponent.displayName);
1616

1717
return glNode;
1818
}

src/createSurface.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ module.exports = function (renderVcontainer, renderVcontent, renderVGL) {
5050
const { via, childGLNode } =
5151
findGLNodeInGLComponentChildren(children);
5252

53+
invariant(childGLNode, "GL.Surface must have in children a GL.Node or a GL Component");
54+
5355
const { data, contentsVDOM, imagesToPreload } =
5456
resolve(
5557
fill(

src/data/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ module.exports = function build (GLNode, parentWidth, parentHeight, parentPreloa
9191
// in any other case, it is an unrecognized invalid format
9292
delete uniforms[name];
9393
if (typeof console !== "undefined" && console.error) console.error("invalid uniform '"+name+"' value:", value); // eslint-disable-line no-console
94-
invariant(false, "Shader #%s: Unrecognized format for uniform '%s'", shader, name);
94+
invariant(false, "Shader '%s': Unrecognized format for uniform '%s'", shaderName, name);
9595
}
9696
});
9797

0 commit comments

Comments
 (0)