The isError function from lodash can be used to check whether a given value is an Error object. Here is an example of how to use it:
index.tsx285 chars14 linesIn the example above, we have a function handleError that takes an error object as an argument. We use the _.isError function to check if the error object is an instance of the Error class. If _.isError returns true, we log the error message to the console. If it returns false, we assume that the passed-in value is not an Error object and log a generic error message.
Note that you need to install lodash to use its functions. You can do so by running npm install lodash in your terminal.
gistlibby LogSnag