summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2017-08-01 23:22:07 +0200
committerJonas Schievink <jonasschievink@gmail.com>2017-08-01 23:23:31 +0200
commit38a13c906ee7d0a9cb05cf1d164ad17b79447758 (patch)
tree2dc46a381d75bd6d86447b7e70ac6c8ba814a43c /src/error.rs
parentbf76e41487fb5aa8e6b28c0b31b4a1d37c44260f (diff)
downloadmlua-38a13c906ee7d0a9cb05cf1d164ad17b79447758.zip
Remove "lua" prefix from error messages
Since this is `rlua::Error`, it should be clear that it refers to Lua-related errors. Downstream crates want to define their own error enums, which can add a prefix like "lua error:" to disambiguate.
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/error.rs b/src/error.rs
index f56223f..1509651 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -112,8 +112,8 @@ impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match *self {
Error::SyntaxError { ref message, .. } => write!(fmt, "syntax error: {}", message),
- Error::RuntimeError(ref msg) => write!(fmt, "Lua runtime error: {}", msg),
- Error::ErrorError(ref msg) => write!(fmt, "Lua error in error handler: {}", msg),
+ Error::RuntimeError(ref msg) => write!(fmt, "runtime error: {}", msg),
+ Error::ErrorError(ref msg) => write!(fmt, "error in error handler: {}", msg),
Error::ToLuaConversionError { from, to, ref message } => {
write!(fmt, "error converting {} to Lua {}", from, to)?;
match *message {
@@ -131,10 +131,10 @@ impl fmt::Display for Error {
write!(fmt, " ({}; expected {})", message, expected),
}
}
- Error::CoroutineInactive => write!(fmt, "Cannot resume inactive coroutine"),
- Error::UserDataTypeMismatch => write!(fmt, "Userdata not expected type"),
- Error::UserDataBorrowError => write!(fmt, "Userdata already mutably borrowed"),
- Error::UserDataBorrowMutError => write!(fmt, "Userdata already borrowed"),
+ Error::CoroutineInactive => write!(fmt, "cannot resume inactive coroutine"),
+ Error::UserDataTypeMismatch => write!(fmt, "userdata is not expected type"),
+ Error::UserDataBorrowError => write!(fmt, "userdata already mutably borrowed"),
+ Error::UserDataBorrowMutError => write!(fmt, "userdata already borrowed"),
Error::CallbackError { ref cause, .. } => write!(fmt, "{}", cause),
Error::ExternalError(ref err) => err.fmt(fmt),
}
@@ -145,14 +145,14 @@ impl StdError for Error {
fn description(&self) -> &str {
match *self {
Error::SyntaxError { .. } => "syntax error",
- Error::RuntimeError(_) => "lua runtime error",
- Error::ErrorError(_) => "lua error handling error",
+ Error::RuntimeError(_) => "runtime error",
+ Error::ErrorError(_) => "error inside error handler",
Error::ToLuaConversionError { .. } => "conversion error to lua",
Error::FromLuaConversionError { .. } => "conversion error from lua",
- Error::CoroutineInactive => "lua coroutine inactive",
- Error::UserDataTypeMismatch => "lua userdata type mismatch",
- Error::UserDataBorrowError => "lua userdata already mutably borrowed",
- Error::UserDataBorrowMutError => "lua userdata already borrowed",
+ Error::CoroutineInactive => "attempt to resume inactive coroutine",
+ Error::UserDataTypeMismatch => "userdata type mismatch",
+ Error::UserDataBorrowError => "userdata already mutably borrowed",
+ Error::UserDataBorrowMutError => "userdata already borrowed",
Error::CallbackError { ref cause, .. } => cause.description(),
Error::ExternalError(ref err) => err.description(),
}