Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor.load should return status #155

Closed
pachacamac opened this issue Jul 13, 2021 · 3 comments
Closed

Editor.load should return status #155

pachacamac opened this issue Jul 13, 2021 · 3 comments
Assignees
Labels
core Issues regarding the core of BaklavaJS

Comments

@pachacamac
Copy link

For example if I load an editor state and I have not registered a node type that is used, there are some warning logged:

Node type TestNode is not registered
Could not find interface with id ni_162594158296227

but there's no way of easily checking if the loading was successful.

@newcat
Copy link
Owner

newcat commented Jul 13, 2021

True! I have two ideas how to solve this, please tell me what you like more (could also do both actually):

  1. Add an optional throwOnError parameter to the load function. In that case, instead of silently failing it will throw an error and fail to load completely
  2. Make the load function return an array of errors. These errors could be either raw strings like what you mentioned above or objects like:
[
  { errorType: "missingNodeType", nodeType: "TestNode"},
  { errorType: "missingInterface", id: "ni_162594158296227" }
]

@newcat newcat added the core Issues regarding the core of BaklavaJS label Jul 13, 2021
@pachacamac
Copy link
Author

The second option is basically what I'm doing right now but checking it after the load step by step. So that would probably be my preferred way. I also like that the whole load doesn't fail if one node type is missing but others are available. So I'm just showing a warning message to the user which types are missing.

@newcat newcat self-assigned this Jul 14, 2021
@newcat
Copy link
Owner

newcat commented Jul 25, 2021

Implemented in v1.9.1

@newcat newcat closed this as completed Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues regarding the core of BaklavaJS
Projects
None yet
Development

No branches or pull requests

2 participants