ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Specifying incorrect type in custom node doens't report error

Open Maykeye opened this issue 1 year ago • 2 comments

Consider

    class ConstFloat:
        @classmethod
        def INPUT_TYPES(s):
            return {"required": { "n":   ("FlOAT", {"default": 1.0, "min": -512.0, "max": 512.0})}}
        RETURN_TYPES = ("FLOAT",)
        FUNCTION = "test"
        CATEGORY = "Example"
        def test(self, n):
            return (n,)

    NODE_CLASS_MAPPINGS = {
        "ConstFloat": ConstFloat
    }

Right now I can add it to the graph normally:

image

There is no indication in the console or browser UI that something is wrong:

Set vram state to: NORMAL VRAM
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
No module 'xformers'. Proceeding without it.
Starting server

To see the GUI go to: http://127.0.0.1:8188

Maykeye avatar Mar 01 '23 13:03 Maykeye

I guess I could have a list of types somewhere but then you would have to add to it every time you want to add a custom type.

Isn't it better for it to be like this?

comfyanonymous avatar Mar 01 '23 17:03 comfyanonymous

Custom types aren't being added as often as they are being used, so having diagnostic would be good. When I mistyped "FlOAT" after copying node that makes const int, I thought for a moment that ints/floats are treated very differently, as nothing was reported.

Or maybe even drop string literals and use python types/wrapper classes. (int/str/float/Latent): right now if I get "LATENT", I have to dig into source code of nodes that use it to see what it really is. With string literals I can't use "go to reference" or use auto complete to see what I am dealing with

Maykeye avatar Mar 02 '23 09:03 Maykeye