<commit_before>package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"strings"

	"github.com/chiku/dashy/app"
	"github.com/gorilla/handlers"
)

// AJAX Request
type dashy struct {
	URL       string   `json:"url"`
	Interests []string `json:"interests"`
}

func toDashboard(dashy *dashy) ([]app.GoPipelineGroup, error) {
	response, err := http.Get(dashy.URL)
	if response == nil {
		return nil, fmt.Errorf("no response from external dashboard")
	}

	if err != nil {
		return nil, fmt.Errorf("bad response external dashboard: %d", response.StatusCode)
	}

	if response.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("bad response code %d for external dashboard", response.StatusCode)<commit_msg>Deal with error before dealing with empty response<commit_after>package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"strings"

	"github.com/chiku/dashy/app"
	"github.com/gorilla/handlers"
)

// AJAX Request
type dashy struct {
	URL       string   `json:"url"`
	Interests []string `json:"interests"`
}

func toDashboard(dashy *dashy) ([]app.GoPipelineGroup, error) {
	response, err := http.Get(dashy.URL)
	if err != nil {
		return nil, fmt.Errorf("bad response external dashboard: %d", response.StatusCode)
	}

	if response == nil {
		return nil, fmt.Errorf("no response from external dashboard")
	}

	if response.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("bad response code %d for external dashboard", response.StatusCode)
{'fraction_non_alphanumeric': 0.13857428381079281, 'fraction_numerical': 0.0, 'mean_word_length': 4.288732394366197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6209589', 'n_tokens_mistral': 535, 'n_tokens_neox': 521, 'n_words': 136}