Skip to content

expose Error Handling via onError prop? #17

@qm210

Description

@qm210

Hi,
shadertoy-react is working really good actually, thanks. However, I wasn't able to find a way to programmatically handle the case that I pass it an erroneous shader? I have that case legitimately because my shader gets built by my react application, so at the moment I can't just guarantee that everything is going fine.
So I see lots of console warnings (and a black screen in shadertoy-react), but would it be an unreasonable effort to make available to catch these errors beforehand?

I'm thinking of a quite unsophisticated prop like onError={err => {/* do stuff with error code, message, whatever */} for the ShadertoyReact component.

I've tried wrapping the thing in try/catch blocks or using react-error-boundary, but they won't fail - as ShadertoyReact doesn't actually fail due to its internal error handling

in any case, great work you did with this library. I totally prefer working with it over the original shadertoy, as it is way smoother.

best,
qm

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions