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

Better error messages when browser fails loading a module #681

Closed
rickmcgeer opened this issue Feb 3, 2023 · 4 comments
Closed

Better error messages when browser fails loading a module #681

rickmcgeer opened this issue Feb 3, 2023 · 4 comments
Assignees
Labels
🐞 bug Something isn't working

Comments

@rickmcgeer
Copy link
Collaborator

When I open a new browser for the first time in a project, and click on 'Load Existing Project' and click 'gravity-game' from the module list, I get the following error:

Error in interactive command add package: Error: (SystemJS) Cannot read properties of undefined (reading 'replace')
	TypeError: Cannot read properties of undefined (reading 'replace')
	    at eval (http://127.0.0.1:9011/lively.lang/string.js:315:131)
	    at Array.reduce (<anonymous>)
	    at ModuleRecord.joinPath (http://127.0.0.1:9011/lively.lang/string.js:315:80)
	    at Window.getPropSettings (http://127.0.0.1:9011/lively.morphic/helpers.js:70:40)
	    at Window.getStylePropertiesFor (http://127.0.0.1:9011/lively.morphic/helpers.js:76:54)
	    at eval (http://127.0.0.1:9011/lively.morphic/components/policy.js:351:40)
	    at ModuleRecord.mapTree (http://127.0.0.1:9011/lively.lang/tree.js:40:12)
	    at PolicyApplicator.StylePolicy_ensureStylePoliciesInSpec_ (http://127.0.0.1:9011/lively.morphic/components/policy.js:339:55)
	    at PolicyApplicator.StylePolicy_initialize_ (http://127.0.0.1:9011/lively.morphic/components/policy.js:137:32)
	    at new PolicyApplicator (http://127.0.0.1:9011/lively.morphic/components/policy.js:707:67)
	Error loading http://127.0.0.1:9011/gravity-game/index.js
(SystemJS) Cannot read properties of undefined (reading 'replace')
	TypeError: Cannot read properties of undefined (reading 'replace')
	    at eval (http://127.0.0.1:9011/lively.lang/string.js:315:131)
	    at Array.reduce (<anonymous>)
	    at ModuleRecord.joinPath (http://127.0.0.1:9011/lively.lang/string.js:315:80)
	    at Window.getPropSettings (http://127.0.0.1:9011/lively.morphic/helpers.js:70:40)
	    at Window.getStylePropertiesFor (http://127.0.0.1:9011/lively.morphic/helpers.js:76:54)
	    at eval (http://127.0.0.1:9011/lively.morphic/components/policy.js:351:40)
	    at ModuleRecord.mapTree (http://127.0.0.1:9011/lively.lang/tree.js:40:12)
	    at PolicyApplicator.StylePolicy_ensureStylePoliciesInSpec_ (http://127.0.0.1:9011/lively.morphic/components/policy.js:339:55)
	    at PolicyApplicator.StylePolicy_initialize_ (http://127.0.0.1:9011/lively.morphic/components/policy.js:137:32)
	    at new PolicyApplicator (http://127.0.0.1:9011/lively.morphic/components/policy.js:707:67)
	Error loading http://127.0.0.1:9011/gravity-game/index.js

This then happens with all existing package loads.
However, when I load galyleo-dashboard into a browser first, gravity-game subsequently loads with no problem.

@linusha
Copy link
Contributor

linusha commented Feb 3, 2023

When I load the gravitygame package, I get the following error:

Error in interactive command add package: Error: (SystemJS) Cannot read http://localhost:9011/galyleo-dashboard/studio/inputs/toggle.cp.js: Not Found 404
	Error: Cannot read http://localhost:9011/galyleo-dashboard/studio/inputs/toggle.cp.js: Not Found 404
	    at WebDAVResource.WebDAVResource_read_ (http://localhost:9011/lively.resources/src/http-resource.js:591:23)
	    at async SystemJSLoader.fetchResource (http://localhost:9011/lively.modules/src/resource.js:35:33)
	Error loading http://localhost:9011/galyleo-dashboard/studio/inputs/toggle.cp.js as "../galyleo-dashboard/studio/inputs/toggle.cp.js" from http://localhost:9011/gravity-game/index.js

This absolutely makes sense, since you are importing stuff from the galyleodashboard package, you need to load that one beforehand.

With the new project architecture, I think we will also think about how to make dependencies in custom packages like this easier to handle, but for now, I think this is working as intended. @merryman feel free to chime in if you disagree, please!

@linusha linusha added the 📟 support inquiry Questions that can be answered without changing code label Feb 3, 2023
@rickmcgeer
Copy link
Collaborator Author

Thanks, @linusha, this makes perfect sense (and is a big relief!) One takeaway here is I could have figured this out easily with a more explanatory browser error message. Maybe a separate ticket? Right now, when the browser refuses to load a module, the programmer is kind of stuck.

@linusha
Copy link
Contributor

linusha commented Feb 3, 2023

No need to make a separate ticket, we will think about this and come back to edit this one.
Glad its working for now.

@linusha linusha changed the title Strange behavior in browsing module Better error messages when browser fails loading a module Feb 17, 2023
@linusha linusha added 🐞 bug Something isn't working and removed 📟 support inquiry Questions that can be answered without changing code labels Feb 17, 2023
@merryman merryman self-assigned this Dec 21, 2023
@merryman
Copy link
Member

Closed in favor of #1119.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants