Catch function in Serverless middleware Plugin in Nodejs

I am having some trouble with the serverless middleware plugin. In the serverless.yml, I can define a function to handle with thrown errors by any of the past functions, but I am not sure about how to identify with error has been thrown, since this function was supposed to be a errorHandler.

Is there some way in NodeJS for me to identify the thrown error? Or there is some way that I can pass this via context to the errorHandler function?