Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Flutter
- 콜렉션
- Class
- set
- 크롤러
- 파이썬
- python
- List
- textstyle
- animation
- kotlin
- import
- 플러터
- map
- Android
- 함수
- 클래스
- variable
- ML
- package
- crawler
- 코틀린
- Yocto
- Collection
- pushnamed
- text
- function
- DART
- 다트
- 웹크롤러
Archives
- Today
- Total
조용한 담장
Dart : Exceptions 본문
Dart Exceptions
Throw
throw FormatException('Expected at least 1 section');
// throw arbitarary objects
throw 'Out of llamas!';
void distanceTo(Point other) => throw UnimplementedError();
Catch
try {
breedMoreLlamas();
} on OutOfLlamasException {
buyMoreLlamas();
}
// multiple catch clauses
try {
breedMoreLlamas();
} on OutOfLlamasException {
// A specific exception
buyMoreLlamas();
} on Exception catch (e) {
// Anything else that is an exception
print('Unknown exception: $e');
} catch (e) {
// No specified type, handles all
print('Something really unknown: $e');
}
// one or two parameters
try {
// ···
} on Exception catch (e) {
print('Exception details:\n $e');
} catch (e, s) {
print('Exception details:\n $e');
print('Stack trace:\n $s');
}
// rethrow to caller
void misbehave() {
try {
dynamic foo = true;
print(foo++); // Runtime error
} catch (e) {
print('misbehave() partially handled ${e.runtimeType}.');
rethrow; // Allow callers to see the exception.
}
}
void main() {
try {
misbehave();
} catch (e) {
print('main() finished handling ${e.runtimeType}.');
}
}
Finally
try {
breedMoreLlamas();
} finally {
// Always clean up, even if an exception is thrown.
cleanLlamaStalls();
}
try {
breedMoreLlamas();
} catch (e) {
print('Error: $e'); // Handle the exception first.
} finally {
cleanLlamaStalls(); // Then clean up.
}
library Error and Exception
- DeferredLoadException
- FormatException
- IntegerDivisionByZeroException
- IOException
- IsolateSpawnException
- TimeoutException
- AbstractClassInstantiationError
- ArgumentError
- AssertionError
- AsyncError
- CastError
- ConcurrentModificationError
- CyclicInitializationError
- FallThroughError
- JsonUnsupportedObjectError
- NoSuchMethodError
- NullThrownError
- OutOfMemoryError
- RemoteError
- StackOverflowError
- StateError
- UnimplementedError
- UnsupportedError
'Dart' 카테고리의 다른 글
Dart : Asynchronous programming (0) | 2019.10.24 |
---|---|
Dart : Class (0) | 2019.10.02 |
Dart : Control flow statements (0) | 2019.09.17 |
Dart : Operators (0) | 2019.09.17 |
Dart 2.5 (0) | 2019.09.11 |
Comments