func errDatum()

in go/webdriver/webdriver_error.go [141:170]


func errDatum(resp *jsonResp) errorDatum {
	if resp.Error != "" {
		for _, cand := range errorData {
			if cand.Error == resp.Error {
				return cand
			}
		}
	}
	if value, ok := resp.Value.(map[string]interface{}); ok {
		if e, ok := value["error"].(string); ok && e != "" {
			for _, cand := range errorData {
				if cand.Error == e {
					return cand
				}
			}
		}
	}
	if resp.Status != nil && *resp.Status != 0 {
		for _, cand := range errorData {
			if cand.Status == *resp.Status {
				return cand
			}
		}
	}
	status := -1
	if resp.Status != nil {
		status = *resp.Status
	}
	return errorDatum{status, resp.Error, 500, false}
}