fromError static method
Wraps a dynamic error within an AlarmException.
Implementation
static AlarmException fromError(
dynamic error, [
StackTrace? stacktrace,
]) {
if (error is AlarmException) {
return error;
}
if (error is PlatformException) {
return fromPlatformException(error);
}
if (error is Exception) {
return fromException(error, stacktrace);
}
return AlarmException(
AlarmErrorCode.unknown,
message: error.toString(),
stacktrace: stacktrace?.toString() ?? StackTrace.current.toString(),
);
}