checkException static method
void
checkException(
- dynamic data
Implementation
static void checkException(final dynamic data) {
try {
final result = data is String ? jsonDecode(data) : data;
if (result['hasException'] != true) {
return;
}
final name = result['name'];
final message = result['message'];
// Log exception details
developer.log('Spike Exception: $name - $message');
if (name == 'SpikeException') {
throw SpikeException(message);
} else if (name == 'SpikeConnectionIsClosedException') {
throw SpikeConnectionIsClosedException(message);
} else if (name == 'SpikeInvalidCredentialsException') {
throw SpikeInvalidCredentialsException(message);
} else if (name == 'SpikeInvalidDateRangeException') {
throw SpikeInvalidDateRangeException(message);
} else if (name == 'SpikeInvalidPostbackUrlException') {
throw SpikeInvalidPostbackUrlException(message);
} else if (name == 'SpikePackException') {
throw SpikePackException(message);
} else if (name == 'SpikePermissionsNotGrantedException') {
throw SpikePermissionsNotGrantedException(message);
} else if (name == 'SpikeServerException') {
throw SpikeServerException(message);
} else if (name == 'SpikeUnpackException') {
throw SpikeUnpackException(message);
} else if (name == 'SpikeCallbackURLNotProvidedException') {
throw SpikeCallbackURLNotProvidedException(message);
}
} catch (error) {
if (error is SpikeException) {
rethrow;
}
}
}