diff options
Diffstat (limited to 'cli/deno_error.rs')
-rw-r--r-- | cli/deno_error.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/deno_error.rs b/cli/deno_error.rs index 551547e26..2c53c84f7 100644 --- a/cli/deno_error.rs +++ b/cli/deno_error.rs @@ -67,6 +67,10 @@ pub fn permission_denied() -> ErrBox { StaticError(ErrorKind::PermissionDenied, "permission denied").into() } +pub fn permission_denied_msg(msg: String) -> ErrBox { + DenoError::new(ErrorKind::PermissionDenied, msg).into() +} + pub fn op_not_implemented() -> ErrBox { StaticError(ErrorKind::OpNotAvailable, "op not implemented").into() } @@ -484,6 +488,14 @@ mod tests { } #[test] + fn test_permission_denied_msg() { + let err = + permission_denied_msg("run again with the --allow-net flag".to_string()); + assert_eq!(err.kind(), ErrorKind::PermissionDenied); + assert_eq!(err.to_string(), "run again with the --allow-net flag"); + } + + #[test] fn test_op_not_implemented() { let err = op_not_implemented(); assert_eq!(err.kind(), ErrorKind::OpNotAvailable); |