server: error handling: convert all unhandled exceptions to API errors

This commit is contained in:
ZXED 2024-03-09 12:07:44 +03:00
parent a4f25f8793
commit bd5cca11b0
No known key found for this signature in database
GPG key ID: 637FB44813DCFD66

View file

@ -24,6 +24,7 @@
#include <chrono> #include <chrono>
#include <condition_variable> #include <condition_variable>
#include <cstddef> #include <cstddef>
#include <exception>
#include <set> #include <set>
#include <mutex> #include <mutex>
#include <thread> #include <thread>
@ -1468,6 +1469,8 @@ struct server_context {
} }
} catch (const llama_error & err) { } catch (const llama_error & err) {
send_error(task, err); send_error(task, err);
} catch (const std::exception & err) {
send_error(task, llama_error("unhandled", err.what()));
} }
} break; } break;
case SERVER_TASK_TYPE_CANCEL: case SERVER_TASK_TYPE_CANCEL: