2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-03 17:58:21 +00:00
This commit is contained in:
2021-02-20 00:10:06 +03:00
parent 4c36f591da
commit cb8e6d5430
9 changed files with 637 additions and 681 deletions

View File

@@ -1,32 +1,29 @@
import 'ExceptionCode.dart';
import 'ErrorType.dart';
class AsyncException implements Exception
{
final ErrorType type;
final int code;
final String message;
class AsyncException implements Exception {
final ErrorType type;
final int code;
final String message;
AsyncException(this.type, this.code, this.message)
{
AsyncException(this.type, this.code, this.message) {}
}
static toAsyncException(Exception ex) {
return ex is AsyncException
? ex
: new AsyncException(ErrorType.Exception, 0, ex.toString());
}
static toAsyncException(Exception ex)
{
return ex is AsyncException ? ex
: new AsyncException(ErrorType.Exception, 0, ex.toString());
}
String errMsg() {
if (type == ErrorType.Management)
return ExceptionCode.values.elementAt(code).toString() +
": " +
(message ?? "");
else
return code.toString() + ": " + message;
}
String errMsg() {
if (type == ErrorType.Management)
return ExceptionCode.values.elementAt(code).toString() + ": " + (message ?? "");
else
return code.toString() + ": " + message;
}
@override
@override
String toString() {
return errMsg();
}