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

Remove Emscripten Node error handling from built library #18

Merged
merged 2 commits into from
Aug 28, 2018

Conversation

nrabinowitz
Copy link
Collaborator

Fixes #7

Stacktrace before change:

$ node test.js 
/Users/nickr/dev/h3-js/dist/out/libh3.js:4
var Module=typeof libh3!=="undefined"?libh3:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="o

Error: Unknown unit: undefined
    at Object.hexArea (/Users/nickr/dev/h3-js/dist/lib/h3core.js:940:19)
    at Object.<anonymous> (/Users/nickr/dev/h3-js/test.js:2:4)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)

Stacktrace after change:

$ node test.js 
/Users/nickr/dev/h3-js/dist/lib/h3core.js:910
            throw new Error(("Unknown unit: " + unit));
            ^

Error: Unknown unit: undefined
    at Object.hexArea (/Users/nickr/dev/h3-js/dist/lib/h3core.js:910:19)
    at Object.<anonymous> (/Users/nickr/dev/h3-js/test.js:2:4)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)

@coveralls
Copy link

Pull Request Test Coverage Report for Build 27

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 23: 0.0%
Covered Lines: 356
Relevant Lines: 356

💛 - Coveralls

@coveralls
Copy link

coveralls commented Aug 28, 2018

Pull Request Test Coverage Report for Build 28

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 23: 0.0%
Covered Lines: 7
Relevant Lines: 7

💛 - Coveralls

Copy link

@isaachier isaachier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using .gitattributes to treat out/libh3.js as a binary file? It would avoid GitHub trying to make a diff of it. Otherwise, LGTM.

@nrabinowitz
Copy link
Collaborator Author

Have you considered using .gitattributes to treat out/libh3.js as a binary file?

Good catch, we have this, but it looks like it didn't get updated when we changed the lib file name. Fixed in the latest commit.

@nrabinowitz nrabinowitz merged commit be8cc67 into uber:master Aug 28, 2018
@nrabinowitz nrabinowitz deleted the node-errors branch August 28, 2018 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants