src/vs/workbench/services/extensions/common/rpcProtocol.ts/MessageIO/serializeReplyErr
class MessageIO:	public static serializeReplyErr(req: number, err: any): VSBuffer {
		const errStr: string | undefined = (err ? safeStringify(errors.transformErrorForSerialization(err), null) : undefined);
		if (typeof errStr !== 'string') {
			return this._serializeReplyErrEmpty(req);
		}
		const errBuff = VSBuffer.fromString(errStr);

		let len = 0;
		len += MessageBuffer.sizeLongString(errBuff);

		let result = MessageBuffer.alloc(MessageType.ReplyErrError, req, len);
		result.writeLongString(errBuff);
		return result.buffer;
	}