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

Poor error handling from openSession() #15

Open
jdduncan opened this issue Oct 3, 2014 · 1 comment
Open

Poor error handling from openSession() #15

jdduncan opened this issue Oct 3, 2014 · 1 comment

Comments

@jdduncan
Copy link
Contributor

jdduncan commented Oct 3, 2014

If you call mynode.openSession() with a connectionProperties literal, and the literal does not have an "implementation" member, you get this exception:

path.js:360
        throw new TypeError('Arguments to path.join must be strings');
              ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Object.exports.getDBServiceProvider (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/impl/SPI.js:41:29)
    at Object.exports.getConnectionKey (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/mynode.js:80:16)
    at getSessionFactory (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/UserContext.js:751:26)
    at exports.UserContext.openSession (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/UserContext.js:2131:5)
    at Object.exports.openSession (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/mynode.js:96:18)
    at Object.<anonymous> (/Users/jdd/bzr-repo/nodejs-adapter/samples/intro.js:12:7)
    at Module._compile (module.js:456:26)
@CraigLRussell
Copy link
Contributor

This is easy to fix if all we want to do is throw a better exception.

But if we want it to work for some definition of "work", we should figure out if there can be a default that we can use today and tomorrow.

We could look around the environment and see if the user has already configured the database/adapter. Environment variables, specially named local files, specially named user files, or specially named global files could be used to find the appropriate configuration.

I expect that if there simply is no suitable database/adapter we will need an error message after all. Not TypeError. ;)

On Oct 3, 2014, at 4:22 PM, John David Duncan wrote:

If you call mynode.openSession() with a connectionProperties literal, and the literal does not have an "implementation" member, you get this exception:

path.js:360
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at Object.exports.getDBServiceProvider (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/impl/SPI.js:41:29)
at Object.exports.getConnectionKey (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/mynode.js:80:16)
at getSessionFactory (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/UserContext.js:751:26)
at exports.UserContext.openSession (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/UserContext.js:2131:5)
at Object.exports.openSession (/Users/jdd/bzr-repo/nodejs-adapter/Adapter/api/mynode.js:96:18)
at Object. (/Users/jdd/bzr-repo/nodejs-adapter/samples/intro.js:12:7)
at Module._compile (module.js:456:26)

Reply to this email directly or view it on GitHub.

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!

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

No branches or pull requests

2 participants