protoblast
Advanced tools
Comparing version 0.7.15 to 0.7.16
@@ -0,1 +1,8 @@ | ||
## 0.7.16 (2022-03-16) | ||
* Make `RURL` understand network protocols when assigning hostnames | ||
* Fix `Error#parseStack()` capturing wrong line & nr of anonymous function | ||
* Fix `Function.setProperty` setting the wrong super property | ||
* Try to get more error data from failed `Request` calls | ||
## 0.7.15 (2022-02-20) | ||
@@ -2,0 +9,0 @@ |
@@ -225,3 +225,4 @@ const ERROR = Symbol('error'); | ||
const V8_NAMED_LINE = /at (.*?) \((.*?):(\d*):(\d*)\)/, | ||
const V8_NAMED_ANON_LINE = /at (.*?) \((?:.*?):(?:\d*):(?:\d*)\), (.*?):(\d*):(\d*)\)/, | ||
V8_NAMED_LINE = /at (.*?) \((.*?):(\d*):(\d*)\)/, | ||
V8_ANON_LINE = /at (.*?):(\d*):(\d*)/, | ||
@@ -236,3 +237,3 @@ FX_LINE = /(.*?)@(.*):(\d*):(\d*)/, | ||
* @since 0.7.13 | ||
* @version 0.7.13 | ||
* @version 0.7.16 | ||
* | ||
@@ -278,3 +279,8 @@ * @param {Error|string} error | ||
if (line.indexOf('(') > -1) { | ||
temp = V8_NAMED_LINE.exec(line); | ||
temp = V8_NAMED_ANON_LINE.exec(line); | ||
if (!temp) { | ||
temp = V8_NAMED_LINE.exec(line); | ||
} | ||
} else { | ||
@@ -281,0 +287,0 @@ temp = V8_ANON_LINE.exec(line); |
@@ -1304,3 +1304,3 @@ var finished_constitutors = new WeakMap(), | ||
* @since 0.1.4 | ||
* @version 0.7.1 | ||
* @version 0.7.16 | ||
* | ||
@@ -1380,5 +1380,5 @@ * @param {Function} constructor Constructor to modify prototype of | ||
target.waitingProperties.push([keys[i], config]); | ||
} else if (is_getter && !super_desc && constructor.super) { | ||
} else if (is_getter && !super_desc && constructor.super && constructor.super.prototype) { | ||
// See if the super constructor already has a descriptor for this | ||
super_desc = Obj.getPropertyDescriptor(constructor.super, keys[i]); | ||
super_desc = Obj.getPropertyDescriptor(constructor.super.prototype, keys[i]); | ||
} | ||
@@ -1385,0 +1385,0 @@ |
@@ -497,3 +497,3 @@ const ORIGINAL_REQUEST = Symbol('ori_req'), | ||
* @since 0.7.10 | ||
* @version 0.7.10 | ||
* @version 0.7.16 | ||
* | ||
@@ -536,2 +536,20 @@ * @param {string} response_body | ||
error.result = result; | ||
// If there is an error and a response object, it might contain more data | ||
if (result && typeof result == 'object') { | ||
let server_error; | ||
if (result instanceof Error) { | ||
server_error = result; | ||
} else if (result.error && result.error instanceof Error) { | ||
server_error = result.error; | ||
} else if (result.message && result.message instanceof Error) { | ||
server_error = result.message; | ||
} | ||
if (server_error) { | ||
error.message = server_error.message; | ||
error.stack = server_error.stack; | ||
} | ||
} | ||
} | ||
@@ -538,0 +556,0 @@ |
@@ -896,3 +896,3 @@ var rx_protocol = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i, | ||
* @since 0.5.7 | ||
* @version 0.5.7 | ||
* @version 0.7.16 | ||
* | ||
@@ -905,6 +905,17 @@ * @type {String} | ||
var pieces; | ||
host = (host || '').toLowerCase(); | ||
// It's possible protocol info is added | ||
let extracted = RURL.extractProtocol(host); | ||
if (extracted.protocol && extracted.protocol.indexOf('.') == -1) { | ||
this._data.protocol = extracted.protocol; | ||
this._data.slashes = extracted.slashes; | ||
host = extracted.rest; | ||
if (!host) { | ||
return host; | ||
} | ||
} | ||
this._data.host = host; | ||
@@ -914,3 +925,3 @@ | ||
if (/:\d+$/.test(host)) { | ||
pieces = host.split(':'); | ||
let pieces = host.split(':'); | ||
this._data.port = pieces.pop() || ''; | ||
@@ -931,3 +942,3 @@ this._data.hostname = pieces.join(':'); | ||
* @since 0.5.7 | ||
* @version 0.5.7 | ||
* @version 0.7.16 | ||
* | ||
@@ -946,2 +957,15 @@ * @type {String} | ||
// It's possible protocol info is added | ||
let extracted = RURL.extractProtocol(hostname); | ||
if (extracted.protocol && extracted.protocol.indexOf('.') == -1) { | ||
this._data.protocol = extracted.protocol; | ||
this._data.slashes = extracted.slashes; | ||
hostname = extracted.rest; | ||
if (!hostname) { | ||
return hostname; | ||
} | ||
} | ||
// Set the new hostname | ||
@@ -948,0 +972,0 @@ this._data.hostname = hostname; |
{ | ||
"name": "protoblast", | ||
"description": "Native object expansion library", | ||
"version": "0.7.15", | ||
"version": "0.7.16", | ||
"author": "Jelle De Loecker <jelle@elevenways.be>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
737871
30558