我试图让这两个类连接起来。PatientMonitorExceptions.scala
abstract class PatientMonitorExceptions extends Exception
case class InvalidHeartRate (str:String) extends PatientMonitorExceptions
这是我尝试使用以下行编译的 main.scala:
main.scala
import gasguru.patient.PatientMonitor
import gasguru.patient.Patient
import gasguru.patient.exceptions.InvalidHeartRate
object Main extends App {
val p = new Patient("snyder","brad");
val v = p.vitalSigns
val pm = new PatientMonitor(p);
p.vitalSigns.heartRate = 160;
println("The patient's heart rate is: " + p.vitalSigns.heartRate + " bpm");
try { pm checkHeartRate v.heartRate
}
catch {
case InvalidHeartRate(x) => println(x);
case _ => println("Something else");
}
}
我正在运行:scala main.scala
编译此错误:加载 InvalidHeartRate 时出错,缺少 ./gasguru/patient/exceptions/InvalidHeartRate.class 所需的依赖项 'class InvalidHeartRate'
这个错误信息是什么意思?