Return APIError with unhandled lgresult in Login

Return unhandled login results in an APIError with the result as the
APIError.Code field and nothing in the APIError.Info field.

Improve type safety by checking the simplejson assertions in Login, return
string errors on bad asserts.

Updated the tests for Login to check the returned errors.