catch TypeError in API

jsonrpc considers all TypeError as "Invalid params" error and return a predefined message.
I don't find yet a way to generalise (with decorator for instance) this modification for all API methods..