Add error handling to resource loding callbacks.