mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-11 00:32:40 +03:00
use msg.fail instead of raising error to provide nicer output on the console
This commit is contained in:
parent
9cf8ac87be
commit
8da042ce17
|
@ -187,12 +187,14 @@ def init_config(
|
||||||
raise ValueError(Errors.E1055) from ex
|
raise ValueError(Errors.E1055) from ex
|
||||||
|
|
||||||
if llm_model is None:
|
if llm_model is None:
|
||||||
raise ValueError(
|
msg.fail(
|
||||||
"Option `llm.model` must be set if `llm` component is in pipeline."
|
"Option `--llm.model` must be set if `llm` component is in pipeline.",
|
||||||
|
exits=1,
|
||||||
)
|
)
|
||||||
if llm_task is None:
|
if llm_task is None:
|
||||||
raise ValueError(
|
msg.fail(
|
||||||
"Option `llm.task` must be set if `llm` component is in pipeline."
|
"Option `--llm.task` must be set if `llm` component is in pipeline.",
|
||||||
|
exits=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Select registry handles for model(s) and task(s). Raise if no match found.
|
# Select registry handles for model(s) and task(s). Raise if no match found.
|
||||||
|
@ -215,9 +217,11 @@ def init_config(
|
||||||
|
|
||||||
if not spec["matched_reg_handle"]:
|
if not spec["matched_reg_handle"]:
|
||||||
arg = spec["arg"]
|
arg = spec["arg"]
|
||||||
raise ValueError(
|
valid_args = sorted(spec["reg_handles"].keys())
|
||||||
f"Couldn't find a matching registration handle for {spec_type} '{spec}'. Double-check"
|
msg.fail(
|
||||||
f" whether '{arg}' is spelled correctly."
|
f"Couldn't find a matching registration handle for {spec_type} '{arg}'. "
|
||||||
|
f"Available functions: {valid_args}",
|
||||||
|
exits=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
defaults = RECOMMENDATIONS["__default__"]
|
defaults = RECOMMENDATIONS["__default__"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user