Skip to content

Commit e75cd5e

Browse files
authored
download: do not exit() on error (#23008)
1 parent 5d44db6 commit e75cd5e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

common/arg.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ static handle_model_result common_params_handle_model(struct common_params_model
357357
auto download_result = common_download_model(model, opts, true);
358358

359359
if (download_result.model_path.empty()) {
360-
LOG_ERR("error: failed to download model from Hugging Face\n");
361-
exit(1);
360+
throw std::runtime_error("failed to download model from Hugging Face");
362361
}
363362

364363
model.name = model.hf_repo;
@@ -380,8 +379,7 @@ static handle_model_result common_params_handle_model(struct common_params_model
380379
opts.offline = offline;
381380
auto download_result = common_download_model(model, opts);
382381
if (download_result.model_path.empty()) {
383-
LOG_ERR("error: failed to download model from %s\n", model.url.c_str());
384-
exit(1);
382+
throw std::runtime_error("failed to download model from " + model.url);
385383
}
386384
}
387385

0 commit comments

Comments
 (0)