api_server/lib/api_server/api_request.js
// handle an error that occurred during the request processing
handle an error that occurred during the request processing
handle an error that occurred during the request processing
async handleErrorResponse () {
		if (!this.statusCode) {
			if (
				(this.gotError && !this.gotError.code) ||
				(typeof this.gotError === 'object' && this.gotError.internal)
			) {
				this.statusCode = 500; 
			}
			else {
				this.statusCode = 403; 
			}
		}
		this.warn(ErrorHandler.log(this.gotError));
		this.responseData = ErrorHandler.toClient(this.gotError);
		this.response.set('X-Request-Id', this.request.id);
		this.response.status(this.statusCode).send(this.responseData);
	}
async handleErrorResponse ( ) { if ( ! this . statusCode ) { if ( ( this . gotError && ! this . gotError . code ) || ( typeof this . gotError === 'object' && this . gotError . internal ) ) { this . statusCode = 500 ; } else { this . statusCode = 403 ; } } this . warn ( ErrorHandler . log ( this . gotError ) ) ; this . responseData = ErrorHandler . toClient ( this . gotError ) ; this . response . set ( 'X-Request-Id' , this . request . id ) ; this . response . status ( this . statusCode ) . send ( this . responseData ) ; }
handle an error that occurred during the request processing
handle an error that occurred during the request processing
// internal errors get a 500 // others get a 403