Wrap Callback functions if LibError is present to ensure errors are not lost

This works... not sure I'm happy with it though so any feedback is welcome! I did think about passing in the reference to the Error handler, but there didn't seem to be a convenient place to store it... Also is there a good place we could cache the reference to it?

Also not sure if there is a better way to wrap the function... sat here for a good while trying to get the ... passed through the inner function but this is the best I could think up..