move error callbacks to adapater.js