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

Swallowing errors #16

Closed
confuser opened this issue Jan 22, 2016 · 3 comments
Closed

Swallowing errors #16

confuser opened this issue Jan 22, 2016 · 3 comments

Comments

@confuser
Copy link

Please see apigee-127/swagger-tools#327 for more information

The .init function is not following standard callback(error, result) style which makes it impossible to pass back any errors.

@whitlockjc
Copy link
Member

swagger-tools' initializeMiddleware was not ever intended to be an "error-first callback" and is not documented to be. There is no safe way to handle an error so passing it back to the caller makes no sense. The code in swagger-tools is doing the right thing. This issue is caused by the version of json-refs in swagger-tools being broken so upgrading to a version that fixes it should fix this issue.

I've now had to reply with a similar response to three separate issues filed in three separate projects. Fixing this in swagger-tools@0.9.x means magic will get the fix automatically and itself does not require any changes to fix this. I will let @theganyo decide whether or not to close this as it's already being addressed in swagger-tools.

@confuser
Copy link
Author

Then can someone explain how I'm supposed to figure out why my Node.js application is crashing when these modules simply hide the error message which would immediately give me an answer on your platform?

To reproduce from the very README on this project:

var a127 = require('a127-magic');
var app = require('express')();

a127.init(function(config) {
  throw new Error('You should see this, but you do not');
  app.use(a127.middleware(config));
  app.listen(process.env.PORT || 10010);
});

Process exits, no error, nothing. How is this a feature?

@whitlockjc
Copy link
Member

I think I've figured it out. I'm closing this and we'll discuss at swagger-tools as this is a swagger-tools issue.

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