public static function throwHabboAPIException($data)
    {
        // Do we find 'maintenance' anywhere?
        if (strstr($data, 'maintenance')) {
            throw new MaintenanceException("Hotel API is down for maintenance");
        }

        // Check if data is JSON
        if ($data[0] == "{") { // Quick 'hack' to see if this could be JSON
            $json = json_decode($data, true);
            if (isset($json['errors'])) {
                if ($json['errors'][0]['msg'] == "user.invalid_name") {
                    throw new UserInvalidException("The name you supplied appears to be invalid");
                }
                $defaultMessage = $json['errors'][0]['msg'];
            } else if (isset($json['error'])) {
                if (preg_match('#not-found#', $json['error'])) {
                    throw new HabboNotFoundException("We can not find the Habbo you're looking for");
                }
                $defaultMessage = $json['error'];
            } else {
                $defaultMessage = $json;
            }
        } else {
            $defaultMessage = "An unknown HTML page was returned";
        }

        throw new Exception("Unknown HabboAPI exception occurred: " . $defaultMessage);
    }