mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
util: prepend '(node) ' to deprecation messages
Changes included in this commit are 1. Making the deprecation messages consistent. The messages will be in the following format x is deprecated. Use y instead. If there is no alternative for `x`, then the ` Use y instead.` part will not be there in the message. 2. All the internal deprecation messages are printed with the prefix `(node) `, except when the `--trace-deprecation` flag is set. Fixes: https://github.com/nodejs/io.js/issues/1883 PR-URL: https://github.com/nodejs/io.js/pull/1892 Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
parent
d55a778bae
commit
9cd44bb2b6
16 changed files with 116 additions and 64 deletions
|
@ -468,7 +468,7 @@ Buffer.prototype.get = internalUtil.deprecate(function get(offset) {
|
|||
if (offset < 0 || offset >= this.length)
|
||||
throw new RangeError('index out of range');
|
||||
return this[offset];
|
||||
}, '.get() is deprecated. Access using array indexes instead.');
|
||||
}, 'Buffer.get is deprecated. Use array indexes instead.');
|
||||
|
||||
|
||||
// XXX remove in v0.13
|
||||
|
@ -477,14 +477,15 @@ Buffer.prototype.set = internalUtil.deprecate(function set(offset, v) {
|
|||
if (offset < 0 || offset >= this.length)
|
||||
throw new RangeError('index out of range');
|
||||
return this[offset] = v;
|
||||
}, '.set() is deprecated. Set using array indexes instead.');
|
||||
}, 'Buffer.set is deprecated. Use array indexes instead.');
|
||||
|
||||
|
||||
// TODO(trevnorris): fix these checks to follow new standard
|
||||
// write(string, offset = 0, length = buffer.length, encoding = 'utf8')
|
||||
var writeWarned = false;
|
||||
const writeMsg = '.write(string, encoding, offset, length) is deprecated.' +
|
||||
' Use write(string[, offset[, length]][, encoding]) instead.';
|
||||
const writeMsg = 'Buffer.write(string, encoding, offset, length) is ' +
|
||||
'deprecated. Use write(string[, offset[, length]]' +
|
||||
'[, encoding]) instead.';
|
||||
Buffer.prototype.write = function(string, offset, length, encoding) {
|
||||
// Buffer#write(string);
|
||||
if (offset === undefined) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue