apigee-127 / swagger-node-runner

The heart of Swagger-Node
MIT License
102 stars 123 forks source link

json_error_handler elusive error #88

Open Celadora opened 7 years ago

Celadora commented 7 years ago

in fittings/json_error_handler.js there is a "TODO: find what's throwing here..."

line 41: delete(context.error);

is the culprit. This cannot be deleted or set to null, or the middleware will fail to resolve next(); I don't know entirely why, and setting it to null will also cause a failure. I suspect that Express is expecting this field to be an Error object, and so ignores calls to next that are missing that property.

To fix this, and prevent leaking error information, please change line 41 in fittings/json_error_handler.js to:

context.error = new Error(null);