code: function writeError(code, res, msg) {
  	try{
  		if (res.headerSent) {
  			logger.error("header Sent:", res.req.method, res.req.originalUrl);
  		}
  		if (httpCodeMapping) {
  			code = mapHttpStatusCode(code);
  		}
  		msg = msg instanceof Error ? msg.message : msg;
  		addStrictTransportHeaders(res);
  		setResponseNoCache(res);
  		if (typeof msg === 'string') {
  			var err = JSON.stringify({Severity: "Error", Message: msg});
  			res.setHeader('Content-Type', 'application/json');
  			res.setHeader('Content-Length', err.length);
  			res.writeHead(code);
  			res.end(err);
  		} else {
  			res.writeHead(code);
  			res.end();
  		}
  	}catch(err){
  		logger.error(res.req.originalUrl , err.message);
  		throw err;
  	}
  }
docs: Helper for writing an error JSON response.
  @param {Number} code
  @param {HttpResponse} res
  @param {String|Error} [msg]