2015-09-10 22:25:36 +00:00
|
|
|
library angular.core.facade.exceptions;
|
|
|
|
|
|
|
|
|
|
import 'exception_handler.dart';
|
|
|
|
|
export 'exception_handler.dart';
|
|
|
|
|
|
|
|
|
|
class BaseException extends Error {
|
2016-01-13 00:38:36 +00:00
|
|
|
final String _message;
|
2015-09-10 22:25:36 +00:00
|
|
|
|
2016-01-13 00:38:36 +00:00
|
|
|
BaseException([this._message]);
|
|
|
|
|
|
|
|
|
|
String get message => _message;
|
2015-09-10 22:25:36 +00:00
|
|
|
|
|
|
|
|
String toString() {
|
|
|
|
|
return this.message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class WrappedException extends Error {
|
2016-01-13 00:38:36 +00:00
|
|
|
final dynamic _context;
|
|
|
|
|
final String _wrapperMessage;
|
2015-09-10 22:25:36 +00:00
|
|
|
final originalException;
|
|
|
|
|
final originalStack;
|
|
|
|
|
|
|
|
|
|
WrappedException(
|
2016-01-13 00:38:36 +00:00
|
|
|
[this._wrapperMessage,
|
2015-10-20 16:38:14 +00:00
|
|
|
this.originalException,
|
|
|
|
|
this.originalStack,
|
2016-01-13 00:38:36 +00:00
|
|
|
this._context]);
|
2015-09-10 22:25:36 +00:00
|
|
|
|
2015-10-20 16:38:14 +00:00
|
|
|
get message {
|
|
|
|
|
return ExceptionHandler.exceptionToString(this);
|
|
|
|
|
}
|
2015-09-10 22:25:36 +00:00
|
|
|
|
2015-10-20 16:38:14 +00:00
|
|
|
String toString() {
|
|
|
|
|
return this.message;
|
|
|
|
|
}
|
2016-01-13 00:38:36 +00:00
|
|
|
|
|
|
|
|
dynamic get context => _context;
|
|
|
|
|
|
|
|
|
|
String get wrapperMessage => _wrapperMessage;
|
2015-09-10 22:25:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Error makeTypeError([String message = ""]) {
|
|
|
|
|
return new BaseException(message);
|
|
|
|
|
}
|
2015-10-08 18:12:17 +00:00
|
|
|
|
|
|
|
|
dynamic unimplemented() {
|
|
|
|
|
throw new BaseException('unimplemented');
|
|
|
|
|
}
|