InterruptException
InterruptException()
The process was stopped by a terminal interrupt (CTRL+C).
Examples
In the Julia programming language, the function InterruptException()
Raises an InterruptException
to signal that the process was stopped by a terminal interrupt (CTRL+C).
Common example of its use:
julia> try
println("Running a long-running process...")
sleep(10) # Simulate a long-running process
catch e
if e isa InterruptException
println("Process interrupted!")
else
rethrow(e)
end
end
In this example, we use a try-catch
block to catch an InterruptException
if the process is interrupted by a terminal interrupt (CTRL+C). If the exception is an InterruptException
, we print a message indicating that the process was interrupted.
Note: Since InterruptException
is raised by the system, we usually don't explicitly call InterruptException()
in our code. It is raised automatically when the process is interrupted by a terminal interrupt (CTRL+C).
See Also
assert, backtrace, code_llvm, code_lowered, code_native, code_typed, code_warntype, :@which, compilecache, current_module, eval, finalize, finalizer, fullname, function_module, function_name, include_dependency, InterruptException, invoke, isconst, isdefined, isgeneric, methodswith, method_exists, module_name, module_parent, require, subtypes, unsafe_load, workspace, __precompile__,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.