📜  飞镖自定义异常 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:02.887000             🧑  作者: Mango

代码示例2
class CustomException implements Exception {
  String cause;
  CustomException(this.cause);
}

void main() {
  try {
    throwException();
  } on CustomException {
    print("custom exception is been obtained");
  }
}

throwException() {
  throw new CustomException('This is my first custom exception');
}