Resolve with an error on timeout/failure.

Add unit tests. Move strings to strings.js.