Disable Error overrides

This commit is contained in:
Fabian Stamm 2018-05-13 21:59:02 +02:00
parent 57c638316e
commit 68f44878d3
4 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,7 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const binary_parser_1 = require("binary-parser"); const binary_parser_1 = require("binary-parser");
const types_1 = require("./types");
const MAX_LABEL_SIZE = 63; const MAX_LABEL_SIZE = 63;
var QueryTypes; var QueryTypes;
(function (QueryTypes) { (function (QueryTypes) {
@ -152,6 +153,7 @@ class Request {
packet.copy(bodyData, 0, 12, packet.length); packet.copy(bodyData, 0, 12, packet.length);
this._header = headerParser.parse(headerData); this._header = headerParser.parse(headerData);
this._header.AD = 0; this._header.AD = 0;
this._header.RCODE = types_1.ErrorCodes.NoError;
this._questions = parseQuestions(this._header.QDCOUNT, bodyData); this._questions = parseQuestions(this._header.QDCOUNT, bodyData);
} }
get header() { get header() {
@ -161,6 +163,7 @@ class Request {
return this._questions.map(e => e); return this._questions.map(e => e);
} }
error(error) { error(error) {
if (this._header.RCODE === types_1.ErrorCodes.NoError)
this._header.RCODE = error; this._header.RCODE = error;
} }
send() { send() {

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "nodename-core", "name": "nodename-core",
"version": "0.1.4", "version": "0.1.5",
"main": "lib/listener.js", "main": "lib/listener.js",
"types": "lib/listener.d.ts", "types": "lib/listener.d.ts",
"author": "Fabian Stamm <dev@fabianstamm.de>", "author": "Fabian Stamm <dev@fabianstamm.de>",

View File

@ -190,10 +190,12 @@ export class Request implements Message {
this._header = <any>headerParser.parse(headerData); this._header = <any>headerParser.parse(headerData);
this._header.AD = 0; this._header.AD = 0;
this._header.RCODE = ErrorCodes.NoError;
this._questions = parseQuestions(this._header.QDCOUNT, bodyData); this._questions = parseQuestions(this._header.QDCOUNT, bodyData);
} }
error(error: ErrorCodes) { error(error: ErrorCodes) {
if (this._header.RCODE === ErrorCodes.NoError)
this._header.RCODE = error; this._header.RCODE = error;
} }