We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 973f881 commit 390d38bCopy full SHA for 390d38b
book/control_flow.md
@@ -328,6 +328,24 @@ try { 1 / 0 } catch { 'An error happened!' } | $in ++ ' And now I am resuming.'
328
329
It will not execute the `catch` block if an error did not occur.
330
331
+`try` also works for external commands:
332
+
333
+```nu
334
+try { ^nonexisting }; print 'a'
335
+# => a
336
337
+^nonexisting; print 'a'
338
+# => Error: nu::shell::external_command
339
+# =>
340
+# => × External command failed
341
+# => ╭─[entry #3:1:2]
342
+# => 1 │ ^nonexisting; print 'a'
343
+# => · ─────┬─────
344
+# => · ╰── Command `nonexisting` not found
345
+# => ╰────
346
+# => help: `nonexisting` is neither a Nushell built-in or a known external command
347
+```
348
349
## Other
350
351
### `return`
0 commit comments