Open must opened 3 years ago
@must I could not reproduce this. Steps that I took:
watch
:
tyfon watch -c ../my-tyfon-client
Modify contents of my-tyfon-server/index.ts
:
export interface User {
name: string;
}
export const getMessage = async (user: User) => {
console.log('Hola!');
return `Hellow ${user.name}!`;
};
my-tyfon-client
, execute this:
ts-node .
As expected, I do get the log Hola!
on the console on the server whenever I invoke the client.
I suppose this might only happen with actual errors. Can you try throwing an error on the backend?
yes errors are not logged by default, they are instead passed to client. this is in sync with behavior in non server client contexts, i.e. when a function is called, the error is caught in the call site, and needs to be handled by the caller (for example, logged).
Yeah, that might make sense for some errors but not necessarily all and especially not in production.
makes sense. a default logging mechanism would be pretty convenient, at least for internal server errors. I assume the standard behavior for these errors should actually change to "don't show error message to client, log it".
When running Tyfon watch, it runs the server as well but it will not display any console.log messages or errors coming from there.