mirror of
https://github.com/Dummi26/mers.git
synced 2026-01-15 23:22:46 +01:00
nicer errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mers"
|
||||
version = "0.8.11"
|
||||
version = "0.8.12"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "dynamically typed but type-checked programming language"
|
||||
@@ -11,7 +11,7 @@ repository = "https://github.com/Dummi26/mers"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
mers_lib = "0.8.11"
|
||||
# mers_lib = { path = "../mers_lib" }
|
||||
# mers_lib = "0.8.12"
|
||||
mers_lib = { path = "../mers_lib" }
|
||||
clap = { version = "4.3.19", features = ["derive"] }
|
||||
colored = "2.1.0"
|
||||
|
||||
19
mers/RuntimeErrors.md
Normal file
19
mers/RuntimeErrors.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Runtime Errors in Mers
|
||||
|
||||
This is a list of <small><small><small><small>(hopefully)</small></small></small></small>
|
||||
all runtime errors that can occur when running a mers program.
|
||||
|
||||
## Explicit
|
||||
|
||||
- Calling `panic` with a `String`-type argument will cause a runtime error, using the argument as the error message.
|
||||
- Calling `exit` will exit with the given (`Int`) exit code. Usually, a nonzero exit code is considered a program failure. While this isn't really a runtime error, `exit` terminate the program just like an error would.
|
||||
|
||||
## Integer-Integer math
|
||||
|
||||
Some math functions fail under certain conditions when called with two integer arguments:
|
||||
|
||||
- `x.div(0)` will fail because you cannot divide by zero. If at least one argument is a `Float`, this will return Infinity or Not A Number.
|
||||
- `x.modulo(0)` will fail
|
||||
- ...
|
||||
|
||||
## ... (TODO)
|
||||
@@ -123,7 +123,7 @@ fn main() {
|
||||
}
|
||||
Ok(_) => {
|
||||
if let Err(e) = compiled.run(&mut i2) {
|
||||
eprintln!("Error while running: {}", e);
|
||||
eprintln!("Error while running:\n{e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ fn main() {
|
||||
}
|
||||
Ok(compiled) => {
|
||||
if let Err(e) = compiled.run(&mut i2) {
|
||||
eprintln!("Error while running: {}", e);
|
||||
eprintln!("Error while running:\n{e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user