dart (flutter) - 예외.
test() {
try {
throw OutOfLlamasException('Expected at least 1 section');
throw 'Out of llamas!';
} on OutOfLlamasException {
// A specific exception
buyMoreLlamas();
} on Exception catch (e) {
// Anything else that is an exception
print('Unknown exception: $e');
} catch (e) {
print('Error: $e'); // Handle the exception first.
} finally {
cleanLlamaStalls(); // Then clean up.
}
}
댓글
댓글 쓰기