From b87d0c4a36c2cfb3d79b09838b88fcab1a8d07f3 Mon Sep 17 00:00:00 2001 From: verdant Date: Thu, 6 Aug 2026 14:52:03 +0800 Subject: Introduce error code system Refactor spawn function, use return error code, provide more clearly error handling. --- src/err.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/err.h') diff --git a/src/err.h b/src/err.h index 6bb4697..bb5ced5 100644 --- a/src/err.h +++ b/src/err.h @@ -1,8 +1,19 @@ #ifndef SS_ERR_H #define SS_ERR_H +#include #include -void die(const char* err, ...); +enum sf_error { + SF_OK = 0, + SF_ERR_INVALID_ARG = -1, + SF_ERR_INVALID_LEN = -2, + SF_ERR_EXEC_FAILED = -3, + SF_ERR_SIGNALED = -4, + SF_ERR_NOMEM = -ENOMEM, + SF_ERR_CANCEL = -1000, +}; + +void die(const char *err, ...); #endif /* SS_ERR_H */ -- cgit v1.2.3