protected void checkErrors(String line, String caller) throws IOException, LoginException
    {
        // System.out.writeln(line);
        // empty response from server
        if (line.isEmpty())
        	// UnknownError...?? changed to IOException
            throw new IOException("Received empty response from server!");
        // successful
        if (line.contains("result=\"Success\""))
            return;
        // rate limit (automatic retry), though might be a long one (e.g. email)
        if (line.contains("error code=\"ratelimited\""))
        {
            log(Level.WARNING, "Server-side throttle hit.", caller);
            throw new HttpRetryException("Action throttled.", 503);
        }
        // blocked!
        if (line.contains("error code=\"blocked") || line.contains("error code=\"autoblocked\""))
        {
            log(Level.SEVERE, "Cannot " + caller + " - user is blocked!.", caller);
            throw new AccountLockedException("Current user is blocked!");
        }
        // cascade protected
        if (line.contains("error code=\"cascadeprotected\""))
        {
            log(Level.WARNING, "Cannot " + caller + " - page is subject to cascading protection.", caller);
            throw new CredentialException("Page is cascade protected");
        }
        // database lock (automatic retry)
        if (line.contains("error code=\"readonly\""))
        {
            log(Level.WARNING, "Database locked!", caller);
            throw new HttpRetryException("Database locked!", 503);
        }
        // action error (no SMWAskAPI extension installed?)
        if (line.contains("error code=\"unknown_action\""))
        {
        	log(Level.WARNING, "Server does not understand action. Needed extension may be missing.", caller);
        	throw new IOException("API does not understand action. Needed extension may be missing.");
        }
        // unknown error
        if (line.contains("error code=\"unknownerror\""))
        	// eclarke: this is unbelievable. don't throw Errors unless there's a problem with the virtual machine.
        	//          fixed to be reasonable 
            // throw new UnknownError("Unknown MediaWiki API error, response was " + line);
        	throw new IOException("Unknown MediaWiki API error, response was "+ line);
        // generic (automatic retry)
        throw new IOException("MediaWiki error, response was " + line);
    }