diff --git a/lib/src/err/mod.rs b/lib/src/err/mod.rs index 0117bff3..cbdd586a 100644 --- a/lib/src/err/mod.rs +++ b/lib/src/err/mod.rs @@ -97,6 +97,13 @@ pub enum Error { message: String, }, + /// There was a problem running the specified function + #[error("There was a problem running the {name}() function. {message}")] + InvalidFunction { + name: String, + message: String, + }, + /// The wrong quantity or magnitude of arguments was given for the specified function #[error("Incorrect arguments for function {name}(). {message}")] InvalidArguments { diff --git a/lib/src/fnc/rand.rs b/lib/src/fnc/rand.rs index b28e222e..c7af2171 100644 --- a/lib/src/fnc/rand.rs +++ b/lib/src/fnc/rand.rs @@ -138,4 +138,11 @@ pub mod uuid { pub fn v7(_: ()) -> Result { Ok(Uuid::new_v7().into()) } + #[cfg(not(uuid_unstable))] + pub fn v7(_: ()) -> Result { + return Err(Error::InvalidFunction { + name: String::from("rand::uuid::v7"), + message: format!("This function is not enabled in this version of SurrealDB."), + }); + } }