set flag if custom callback is given (feature for webdriverjs)

I need to know if a custom callback is given for webdriverjs to handle errors properly (throw if no callback is given otherwise assign as 1st parameter)