throwError function
This method handles the plugin platform exceptions by logging them into the console.
Implementation
void throwError(PlatformException e, String caller) {
print("unexpected error was caught while $caller");
print("error code: ${e.code}");
print("error message: ${e.message}");
print("error cause: ${e.details}");
}