Skip to content

Commit f28075d

Browse files
committed
continue looping if fail to decode
1 parent fb23130 commit f28075d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

cmd/device-definitions-api/decode_vin.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
118118
// use the dat group service to decode
119119
if err != nil {
120120
fmt.Println(err.Error())
121+
continue
121122
}
122123

123124
fmt.Printf("\n\nVIN Response: %+v\n", vinInfo)
@@ -126,7 +127,7 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
126127
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, dt, coremodels.DrivlyProvider, country)
127128
if err != nil {
128129
fmt.Println(err.Error())
129-
return subcommands.ExitFailure
130+
continue
130131
}
131132

132133
fmt.Printf("VIN Response: %+v\n", vinInfo)
@@ -135,7 +136,7 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
135136
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, dt, coremodels.VincarioProvider, country)
136137
if err != nil {
137138
fmt.Println(err.Error())
138-
return subcommands.ExitFailure
139+
continue
139140
}
140141

141142
fmt.Printf("VIN Response: %+v\n", vinInfo)
@@ -144,7 +145,7 @@ func (p *decodeVINCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interf
144145
vinInfo, err = vinDecodingService.GetVIN(ctx, vin, dt, coremodels.Japan17VIN, country)
145146
if err != nil {
146147
fmt.Println(err.Error())
147-
return subcommands.ExitFailure
148+
continue
148149
}
149150
jsonBytes, _ := json.MarshalIndent(vinInfo, "", " ")
150151
fmt.Println("VIN Info:")
@@ -204,15 +205,15 @@ func readVINFile(filename string) ([]string, error) {
204205

205206
csvColumnIndex := -1
206207
for i, columnName := range header {
207-
if columnName == "csv" {
208+
if columnName == "vins" {
208209
csvColumnIndex = i
209210
break
210211
}
211212
}
212213

213214
if csvColumnIndex == -1 {
214215
csvColumnIndex = 0 // default to first column if "csv" column not found
215-
fmt.Println("defaulting to first column as 'csv' column not found, please ensure your CSV file has a column named 'csv' with VINs in it.")
216+
fmt.Println("defaulting to first column as 'vins' column not found, please ensure your CSV file has a column named 'vins' with VINs in it.")
216217
}
217218

218219
// Read all rows and extract values from the "csv" column

0 commit comments

Comments
 (0)