From 5eae7422af73d579903493888ccf18b2e6d0fc04 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 19 Feb 2023 10:45:05 +0100 Subject: [PATCH] Add error code and help --- src/error.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index aefeb5f..177f3b3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -22,7 +22,7 @@ impl Diagnostic for CrateError { match self { CrateError::NuShellError(n) => n.code(), CrateError::NuParseError(n) => n.code(), - _ => None, + Self::FunctionNotFound(_) => Some(Box::new("embed_nu::fn_not_found")), } } @@ -38,7 +38,9 @@ impl Diagnostic for CrateError { match self { CrateError::NuShellError(n) => n.help(), CrateError::NuParseError(n) => n.help(), - _ => None, + CrateError::FunctionNotFound(_) => Some(Box::new( + "Make sure the function you want to execute is defined at this point.", + )), } }