From 27f53013c97e3bc401035fcb0a43cf5ee5c2f4af Mon Sep 17 00:00:00 2001 From: Aaron Teo Date: Sat, 21 Mar 2026 14:32:32 +0800 Subject: [PATCH] args: use invalid_argument instead of runtime_error Signed-off-by: Aaron Teo --- common/arg.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/common/arg.cpp b/common/arg.cpp index a189567023..a63bc5b9a2 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -10,7 +10,6 @@ #include "sampling.h" #include "speculative.h" #include "preset.h" -#include // fix problem with std::min and std::max #if defined(_WIN32) @@ -2207,9 +2206,9 @@ common_params_context common_params_parser_init(common_params & params, llama_ex } add_opt(common_arg( {"--mlock"}, - "force system to keep model in RAM rather than swapping or compressing", + "DEPRECATED: force system to keep model in RAM rather than swapping or compressing", [](common_params & params) { - throw std::runtime_error("error: --mlock is deprecated. use --load-mode mlock instead"); + throw std::invalid_argument("--mlock is deprecated. use --load-mode mlock instead"); GGML_UNUSED(params); } @@ -2217,9 +2216,9 @@ common_params_context common_params_parser_init(common_params & params, llama_ex add_opt(common_arg( {"--mmap"}, {"--no-mmap"}, - "whether to memory-map model. (if mmap disabled, slower load but may reduce pageouts if not using mlock)", + "DEPRECATED: whether to memory-map model. (if mmap disabled, slower load but may reduce pageouts if not using mlock)", [](common_params & params, bool value) { - throw std::runtime_error("error: --mmap and --no-mmap are deprecated. use --load-mode mmap instead"); + throw std::invalid_argument("--mmap and --no-mmap are deprecated. use --load-mode mmap instead"); GGML_UNUSED(params); GGML_UNUSED(value); @@ -2228,9 +2227,9 @@ common_params_context common_params_parser_init(common_params & params, llama_ex add_opt(common_arg( {"-dio", "--direct-io"}, {"-ndio", "--no-direct-io"}, - "use DirectIO if available", + "DEPRECATED: use DirectIO if available", [](common_params & params, bool value) { - throw std::invalid_argument("error: -dio/--direct-io and -ndio/--no-direct-io are deprecated. use --load-mode dio instead"); + throw std::invalid_argument("-dio/--direct-io and -ndio/--no-direct-io are deprecated. use --load-mode dio instead"); GGML_UNUSED(params); GGML_UNUSED(value);