Blog Clip Art Line Drawing

Monitoring Evaluation Plan Template

recto anterior septo del recto anterior y rotura muscular easy

:
Event Planning Proposal Template
Expose http parse error codes
Currently http parse errors do not expose the error details available from http_parser. This patch exposes the error code as `err.code`.
1 parent Business Cards Online commit 1824019

Business Cards Unique 2 files changed How To Write Up A Post Launch Product Review

Lines changed: 7 additions & 0 deletions

Start To Build Clip Art Monitoring Evaluation Plan Template

src/node_http_parser.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,12 @@ class Parser : public ObjectWrap {
432432
// If there was a parse error in one of the callbacks
433433
// TODO What if there is an error on EOF?
434434
if (!parser->parser_.upgrade && nparsed != len) {
435+
enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_);
436+
435437
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
436438
Local<Object> obj = e->ToObject();
437439
obj->Set(String::NewSymbol("bytesParsed"), nparsed_obj);
440+
obj->Set(String::NewSymbol("code"), String::New(http_errno_name(err)));
438441
return scope.Close(e);
439442
} else {
440443
return scope.Close(nparsed_obj);
@@ -455,9 +458,12 @@ class Parser : public ObjectWrap {
455458
if (parser->got_exception_) return Local<Value>();
456459

457460
if (rv != 0) {
461+
enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_);
462+
458463
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
459464
Local<Object> obj = e->ToObject();
460465
obj->Set(String::NewSymbol("bytesParsed"), Integer::New(0));
466+
obj->Set(String::NewSymbol("code"), String::New(http_errno_name(err)));
461467
return scope.Close(e);
462468
}
463469

test/simple/test-http-client-parse-error.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ srv.listen(common.PORT, '127.0.0.1', function() {
4848
console.log('got error from client');
4949
srv.close();
5050
assert.ok(e.message.indexOf('Parse Error') >= 0);
51+
assert.equal(e.code, 'HPE_INVALID_CONSTANT');
5152
parseError = true;
5253
});
5354
});

Features Of A Blog Post Monitoring Evaluation Plan Template

Comments
 (0)