-
Notifications
You must be signed in to change notification settings - Fork 63
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
Better error messages when importing an unavailable .ksy #161
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GreyCat
approved these changes
Dec 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this! Looks great to me!
For example, consider the following spec, which attempts to import a non-existent .ksy file from local storage: ```ksy meta: id: imports_non_existent_local imports: - non_existent ``` Old error: ``` Parse error (TypeError): Cannot read properties of null (reading 'indexOf') Call stack: TypeError: Cannot read properties of null (reading 'indexOf') at Parser.cleanup (https://ide.kaitai.io/lib/_npm/yamljs/yaml.js:1220:15) at Parser.parse (https://ide.kaitai.io/lib/_npm/yamljs/yaml.js:754:23) at Yaml.parse (https://ide.kaitai.io/lib/_npm/yamljs/yaml.js:1817:25) at JsImporter.importYaml (https://ide.kaitai.io/js/v1/KaitaiServices.js:51:33) ``` New error: ``` (main): /meta/imports/0: error: Error: failed to import spec non_existent.ksy from local storage: file not found ``` Import failures from the remote location "kaitai.io" are now also handled - consider this spec: ```ksy meta: id: imports_non_existent_remote imports: - /common/non_existent ``` Old error: ``` Parse error Call stack: undefined ``` New error: ``` (main): /meta/imports/0: error: Error: failed to import spec formats/common/non_existent.ksy from kaitai.io: file not found ``` When the server responds with some other HTTP status code than 404: ``` (main): /meta/imports/0: error: Error: failed to import spec formats/common/bcd.ksy from kaitai.io: server responded with HTTP status 500 (Internal Server Error) ``` When you are no longer connected to the internet, but try to import a remote spec that hasn't been cached locally by the browser: ``` (main): /meta/imports/0: error: Error: failed to import spec formats/common/bcd.ksy from kaitai.io: cannot reach the server (message: Failed to fetch), check your internet connection ```
generalmimon
force-pushed
the
better-import-errors
branch
from
December 10, 2023 21:12
3c4ac00
to
c6eda83
Compare
generalmimon
added a commit
to kaitai-io/kaitai-io.github.io
that referenced
this pull request
Feb 22, 2024
Related Web IDE pull requests with the changes: * kaitai-io/kaitai_struct_webide#170 * kaitai-io/kaitai_struct_webide#169 * kaitai-io/kaitai_struct_webide#166 * kaitai-io/kaitai_struct_webide#162 * kaitai-io/kaitai_struct_webide#163 * kaitai-io/kaitai_struct_webide#161
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For example, consider the following spec, which attempts to import a non-existent .ksy file from local storage:
Old error:
New error:
Import failures from the remote location "kaitai.io" are now also handled - consider this spec:
Old error:
New error:
When the server responds with some other HTTP status code than 404:
When you are no longer connected to the internet, but try to import a remote spec that hasn't been cached locally by the browser: