This commit is contained in:
John Smith
2022-12-14 16:50:33 -05:00
parent 78d06fb187
commit f0674e46d1
6 changed files with 235 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:html';
import 'dart:typed_data';
import 'dart:convert';
@@ -1571,6 +1572,8 @@ abstract class VeilidAPIException implements Exception {
}
}
}
String toDisplayError();
}
class VeilidAPIExceptionNotInitialized implements VeilidAPIException {
@@ -1578,6 +1581,11 @@ class VeilidAPIExceptionNotInitialized implements VeilidAPIException {
String toString() {
return "VeilidAPIException: NotInitialized";
}
@override
String toDisplayError() {
return "Not initialized";
}
}
class VeilidAPIExceptionAlreadyInitialized implements VeilidAPIException {
@@ -1585,6 +1593,11 @@ class VeilidAPIExceptionAlreadyInitialized implements VeilidAPIException {
String toString() {
return "VeilidAPIException: AlreadyInitialized";
}
@override
String toDisplayError() {
return "Already initialized";
}
}
class VeilidAPIExceptionTimeout implements VeilidAPIException {
@@ -1592,6 +1605,11 @@ class VeilidAPIExceptionTimeout implements VeilidAPIException {
String toString() {
return "VeilidAPIException: Timeout";
}
@override
String toDisplayError() {
return "Timeout";
}
}
class VeilidAPIExceptionShutdown implements VeilidAPIException {
@@ -1599,6 +1617,11 @@ class VeilidAPIExceptionShutdown implements VeilidAPIException {
String toString() {
return "VeilidAPIException: Shutdown";
}
@override
String toDisplayError() {
return "Currently shut down";
}
}
class VeilidAPIExceptionNodeNotFound implements VeilidAPIException {
@@ -1609,6 +1632,11 @@ class VeilidAPIExceptionNodeNotFound implements VeilidAPIException {
return "VeilidAPIException: NodeNotFound (nodeId: $nodeId)";
}
@override
String toDisplayError() {
return "Node node found: $nodeId";
}
//
VeilidAPIExceptionNodeNotFound(this.nodeId);
}
@@ -1621,6 +1649,11 @@ class VeilidAPIExceptionNoDialInfo implements VeilidAPIException {
return "VeilidAPIException: NoDialInfo (nodeId: $nodeId)";
}
@override
String toDisplayError() {
return "No dial info: $nodeId";
}
//
VeilidAPIExceptionNoDialInfo(this.nodeId);
}
@@ -1633,6 +1666,11 @@ class VeilidAPIExceptionInternal implements VeilidAPIException {
return "VeilidAPIException: Internal ($message)";
}
@override
String toDisplayError() {
return "Internal error: $message";
}
//
VeilidAPIExceptionInternal(this.message);
}
@@ -1645,6 +1683,11 @@ class VeilidAPIExceptionUnimplemented implements VeilidAPIException {
return "VeilidAPIException: Unimplemented ($message)";
}
@override
String toDisplayError() {
return "Unimplemented: $message";
}
//
VeilidAPIExceptionUnimplemented(this.message);
}
@@ -1658,6 +1701,11 @@ class VeilidAPIExceptionParseError implements VeilidAPIException {
return "VeilidAPIException: ParseError ($message)\n value: $value";
}
@override
String toDisplayError() {
return "Parse error: $message";
}
//
VeilidAPIExceptionParseError(this.message, this.value);
}
@@ -1672,6 +1720,11 @@ class VeilidAPIExceptionInvalidArgument implements VeilidAPIException {
return "VeilidAPIException: InvalidArgument ($context:$argument)\n value: $value";
}
@override
String toDisplayError() {
return "Invalid argument for $context: $argument";
}
//
VeilidAPIExceptionInvalidArgument(this.context, this.argument, this.value);
}
@@ -1685,6 +1738,11 @@ class VeilidAPIExceptionMissingArgument implements VeilidAPIException {
return "VeilidAPIException: MissingArgument ($context:$argument)";
}
@override
String toDisplayError() {
return "Missing argument for $context: $argument";
}
//
VeilidAPIExceptionMissingArgument(this.context, this.argument);
}
@@ -1697,6 +1755,11 @@ class VeilidAPIExceptionGeneric implements VeilidAPIException {
return "VeilidAPIException: Generic (message: $message)";
}
@override
String toDisplayError() {
return message;
}
//
VeilidAPIExceptionGeneric(this.message);
}