code formatting

This commit is contained in:
David Frank 2016-04-06 01:43:12 +08:00
parent 364edcf04b
commit 974666a3a8
5 changed files with 22 additions and 9 deletions

View File

@ -1,7 +1,8 @@
/**
* response.js
* body.js
*
* Response class provides content decoding
* Body interface provides common methods for Request and Response
*/
var convert = require('encoding').convert;
@ -12,7 +13,7 @@ var FetchError = require('./fetch-error');
module.exports = Body;
/**
* Response class
* Body class
*
* @param Stream body Readable stream
* @param Object opts Response options

View File

@ -1,25 +1,34 @@
/**
* fetch-error.js
*
* FetchError class for operational errors
* FetchError interface for operational errors
*/
module.exports = FetchError;
/**
* Create FetchError
* Create FetchError instance
*
* @param String reason String type Error optionalSystemError
* @param String message Error message for human
* @param String type Error type for machine
* @param String systemError For Node.js system error
* @return FetchError
*/
function FetchError(message, type, optionalSystemError) {
function FetchError(message, type, systemError) {
// hide custom error implementation details from end-users
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.type = type;
if (optionalSystemError) {
this.code = this.errno = optionalSystemError.code;
// when err.type is `system`, err.code contains system error code
if (systemError) {
this.code = this.errno = systemError.code;
}
}
require('util').inherits(FetchError, Error);

View File

@ -1,3 +1,4 @@
/**
* headers.js
*

View File

@ -1,3 +1,4 @@
/**
* request.js
*

View File

@ -1,3 +1,4 @@
/**
* response.js
*