异常类
class ProcessException
public class ProcessException <: IOException {
public init(message: String)
}
功能:process 包的异常类。
父类型:
init(String)
public init(message: String)
功能:创建 ProcessException 实例。
参数:
- message: String - 异常提示信息。
示例:
import std.process.*
main(): Int64 {
try {
throw ProcessException("Process failed to start")
} catch (e: ProcessException) {
println("Caught ProcessException: ${e.message}")
println("Exception type: ${e}")
}
return 0
}
运行结果:
Caught ProcessException: Process failed to start
Exception type: ProcessException: Process failed to start