Skip to content

Commit 850cd94

Browse files
authored
Merge pull request #92 from mitre/fix-batch
Correct comparison of location prefix
2 parents 928617b + 26823f8 commit 850cd94

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

fusera.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ func NewFusera(ctx context.Context, opt *Options) (*Fusera, error) {
9393
if strings.HasPrefix(opt.Loc, "s3") {
9494
batch = opt.AwsBatch
9595
}
96-
if strings.HasPrefix(opt.Loc, "gcp") {
96+
if strings.HasPrefix(opt.Loc, "gs") {
9797
batch = opt.GcpBatch
9898
}
9999
accessions, err := nr.ResolveNames(opt.ApiEndpoint, opt.Loc, opt.Ngc, batch, opt.Acc)
100100
if err != nil {
101101
fmt.Println(err.Error())
102-
// return nil, err
102+
return nil, err
103103
}
104104
fs := &Fusera{
105105
accs: accessions,

nr/nr.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ func makeBatchRequest(url string, writer *multipart.Writer, body io.Reader) ([]P
8888
// accs: the accessions to resolve names for.
8989
func ResolveNames(url, loc string, ngc []byte, batch int, accs map[string]bool) (map[string]*Accession, error) {
9090
if accs == nil {
91-
return nil, errors.New("must provide accs to ResolveNames")
91+
return nil, errors.New("must provide accessions to pass to Name Resolver API")
9292
}
9393
if loc == "" {
94-
return nil, errors.New("must provide a location to ResolveNames")
94+
return nil, errors.New("must provide a location to pass to Name Resolver API")
9595
}
9696
if batch < 1 {
97-
return nil, errors.Errorf("must provide a batch number greater than 0: %d", batch)
97+
return nil, errors.Errorf("must provide a valid batch number, gave: %d", batch)
9898
}
9999
if url == "" {
100100
url = "https://www.ncbi.nlm.nih.gov/Traces/sdl/1/retrieve"

0 commit comments

Comments
 (0)