doc: update error messages

This commit is contained in:
Artemy 2022-08-06 17:19:28 +03:00
parent 29113c9ff6
commit 774517f4e2

View file

@ -50,7 +50,7 @@ impl Interpreter {
self.print(&vec![Value::String(value.to_string())], false); self.print(&vec![Value::String(value.to_string())], false);
} }
_ => { _ => {
self.error("Unsupported data type for the print argument"); self.error("Unsupported data type for the `print` argument, must be a string or an array");
} }
}, },
"println" => match value { "println" => match value {
@ -61,7 +61,7 @@ impl Interpreter {
self.print(&vec![Value::String(value.to_string())], true); self.print(&vec![Value::String(value.to_string())], true);
} }
_ => { _ => {
self.error("Unsupported data type for the println argument"); self.error("Unsupported data type for the `println` argument, must be a string or an array");
} }
}, },
"calc" => match value { "calc" => match value {
@ -69,11 +69,11 @@ impl Interpreter {
if value.len() == 3 { if value.len() == 3 {
return self.calc(value); return self.calc(value);
} else { } else {
self.error("Unsupported data type for the calc arguments"); self.error("Unsupported data type for the `calc` arguments, must be an array with three arguments");
} }
} }
_ => { _ => {
self.error("Unsupported data type for the calc arguments"); self.error("Unsupported data type for the `calc` arguments, must be an array with three arguments");
} }
}, },
"comp" => match value { "comp" => match value {
@ -81,11 +81,11 @@ impl Interpreter {
if value.len() == 3 { if value.len() == 3 {
return self.comp(value); return self.comp(value);
} else { } else {
self.error("Unsupported data type for the comp arguments"); self.error("Unsupported data type for the `comp` arguments, must be an array with three arguments");
} }
} }
_ => { _ => {
self.error("Unsupported data type for the comp arguments"); self.error("Unsupported data type for the `comp` arguments, must be an array with three arguments");
} }
}, },
"let" => match value { "let" => match value {
@ -93,7 +93,7 @@ impl Interpreter {
return self.define(value); return self.define(value);
} }
_ => { _ => {
self.error("Unsupported data type for the let argument"); self.error("Unsupported data type for the `let` argument, must be an object");
} }
}, },
"assign" => match value { "assign" => match value {
@ -101,7 +101,7 @@ impl Interpreter {
return self.assign(value); return self.assign(value);
} }
_ => { _ => {
self.error("Unsupported data type for the let argument"); self.error("Unsupported data type for the `assign` argument, must be an object");
} }
}, },
"var" => match value { "var" => match value {
@ -109,7 +109,7 @@ impl Interpreter {
return self.get_var(value); return self.get_var(value);
} }
_ => { _ => {
self.error("Unsupported data type for the let argument"); self.error("Unsupported data type for the `var` argument, must be a string");
} }
}, },
"input" => match value { "input" => match value {
@ -117,7 +117,7 @@ impl Interpreter {
return self.input(value); return self.input(value);
} }
_ => { _ => {
self.error("Unsupported data type for the input argument"); self.error("Unsupported data type for the `input` argument, must be a string");
} }
}, },
"sleep" => match value { "sleep" => match value {
@ -125,7 +125,7 @@ impl Interpreter {
self.sleep(value); self.sleep(value);
} }
_ => { _ => {
self.error("Unsupported data type for the sleep argument"); self.error("Unsupported data type for the `sleep` argument, must be a number");
} }
}, },
"if" => match value { "if" => match value {
@ -133,7 +133,7 @@ impl Interpreter {
return self.if_node(value); return self.if_node(value);
} }
_ => { _ => {
self.error("Unsupported data type for the if argument"); self.error("Unsupported data type for the `if` argument, must be an object");
} }
}, },
"loop" => match value { "loop" => match value {
@ -141,7 +141,7 @@ impl Interpreter {
return self.loop_cycle(value); return self.loop_cycle(value);
} }
_ => { _ => {
self.error("Unsupported data type for the loop cycle argument"); self.error("Unsupported data type for the `loop cycle` argument, must be an array");
} }
}, },
name => { name => {