diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-10-23 08:35:43 +0900 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-10-22 19:35:43 -0400 |
commit | 2804ba8674150b80ee181cc3869e1fa12de661d3 (patch) | |
tree | 494a96b2afe927cbe8eff6c941ca8e0afbd39446 /cli/deno_error.rs | |
parent | edd6a90da855619feecb05c2cf87448b0c23da86 (diff) |
remove --no-prompt flag, fail on missing permissions (#3183)
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); |