Skip to content

errors are not necessary in some cases #74

Description

@ORESoftware

I think there is a specification error in the code

Uncaught Error: process.binding is not supported
    at Object.process.binding (suman.js:293)
    at Object.<anonymous> (suman.js:51174)
    at Object.module.exports.100 (suman.js:51178)
    at __webpack_require__ (suman.js:20)
    at Object.<anonymous> (suman.js:3417)
    at __webpack_require__ (suman.js:20)
    at Object.<anonymous> (suman.js:38562)
    at Object.<anonymous> (suman.js:39238)
    at __webpack_require__ (suman.js:20)
    at Object.<anonymous> (suman.js:80743)

It would be much better if process.binding() and process.chdir() were no-ops.
Throwing an error literally just breaks things, there is no point in polyfilling functions and just throwing an error, it doesn't make any sense. If the behavior is not supported in the browser just make it a noop. I hope this makes sense to you!

As you can see, in your existing code process.cwd() is pretty much a no-op even though it's not supported in the browser really either.

process.binding = function (name) {
    throw new Error('process.binding is not supported');  //does nobody any favors
};

process.cwd = function () { return '/' };

process.chdir = function (dir) {
    throw new Error('process.chdir is not supported');  // does nobody any favors
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions