FEAT: protospack-v2 updated

This commit is contained in:
Arthur Simas
2022-07-07 15:00:59 -03:00
parent 59ffb24985
commit 4c49dbc0ea
5 changed files with 23 additions and 63 deletions
-19
View File
@@ -1,19 +0,0 @@
import { Logger } from '@nestjs/common';
import { RpcException } from '@nestjs/microservices';
import { from } from 'rxjs';
import ErrorBuilder from './ErrorBuilder';
const logger = new Logger();
export default async function grpcHandler<T>(method: Promise<T>) {
return new Promise<T>((resolve, reject) => {
from(method).subscribe({
next: resolve,
error: reject,
complete: () => logger.log('done'),
});
}).catch((err: RpcException) => {
throw new ErrorBuilder(err);
});
}