code formatting
This commit is contained in:
parent
364edcf04b
commit
974666a3a8
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* headers.js
|
||||
*
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* request.js
|
||||
*
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* response.js
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue