#Micro-service throws a RCPException But Controller gets 500

18 messages · Page 1 of 1 (latest)

rich hamlet
#

I was able to catch the error and transform it, doing this:

async method(): Promise<any> { return this.client.send('cmd', { }).pipe( catchError(err => { return of(err instanceof RpcException); }));

#

Looking for something generic at client level

rich hamlet
#

@leaden vine when you have time, I'd like if you please take a look of this

leaden vine
#

And when you have time, I'd like you to take a look at our rules int he welcome channel again. Specifically number 6 😉

#

You will never get an err to be instanceof RpcExceptin because the error has tobe serialized and deserialized between the microservice server and the client

#

You can create your own proxy extension that does deserialize it though

rich hamlet
#

On the other hand should I extend the clientProxy and override the deserializer method?

leaden vine
#

You can

rich hamlet
#

So, this will work for that? return new RcpException(err.message) I saw something similar in a forum

leaden vine
#

Try it out and see 🙂

rich hamlet
#

The last question, why the initial code that I paste here works If I didn't implement a deserializer method?

#

thanks in advance

leaden vine
rich hamlet
#

No, I got actually the RCPException. Should I sent a file o piece of code, just let me know

leaden vine
#

Yeah, cause I wouldn't expect to see RPCException unless it came from within the same server

rich hamlet
#

I alredy fixed my issue based in your solution