Skip to content

question: how to load a json file in preload only if it exists #3416

Closed
@dhowe

Description

@dhowe

Tried this with with a try/catch in preload and got the error below, after which the sketch hangs on 'Loading'. Might be nice if there was a way to load, for example, a .json config file in preload (without being forced to use the callback version of loadJSON) and have the sketch continue if its not there...

> p5.js says: It looks like there was a problem loading your json. Try checking if the file path [config.json] is correct, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]
p5.js:62653 Uncaught (in promise) Error: [object Object]
    at p5.js:62653

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions