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