Fix error handling for requirejs