From df3739c147a9e1e1f9e98604848a50754326c282 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Fri, 19 Jan 2024 13:01:32 +0100 Subject: [PATCH 1/2] fix: improve error reporting for web platform --- lib/fpjs_pro_plugin_web.dart | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/fpjs_pro_plugin_web.dart b/lib/fpjs_pro_plugin_web.dart index f1042dd..06bb494 100644 --- a/lib/fpjs_pro_plugin_web.dart +++ b/lib/fpjs_pro_plugin_web.dart @@ -79,7 +79,11 @@ class FpjsProPluginWeb { _isExtendedResult = call.arguments['extendedResponseFormat']; _isInitialized = true; } catch (e) { - throw unwrapWebError(e as WebException); + if (e is WebException) { + throw unwrapWebError(e); + } else { + throw UnknownError(e.toString()); + } } } @@ -99,7 +103,11 @@ class FpjsProPluginWeb { fp.get(FingerprintJSGetOptions(linkedId: linkedId, tag: tags))); return result.visitorId; } catch (e) { - throw unwrapWebError(e as WebException); + if (e is WebException) { + throw unwrapWebError(e); + } else { + throw UnknownError(e.toString()); + } } } @@ -136,7 +144,11 @@ class FpjsProPluginWeb { serializedResult ]; } catch (e) { - throw unwrapWebError(e as WebException); + if (e is WebException) { + throw unwrapWebError(e); + } else { + throw UnknownError(e.toString()); + } } } } From 219467f1b310a655f4e80091d7e0c949ffc645fe Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Fri, 19 Jan 2024 13:11:48 +0100 Subject: [PATCH 2/2] fix: add TooManyRequestError for web platform --- lib/web_error.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web_error.dart b/lib/web_error.dart index 9c3e957..407cf98 100644 --- a/lib/web_error.dart +++ b/lib/web_error.dart @@ -35,7 +35,7 @@ FingerprintProError unwrapWebError(WebException error) { return RequestTimeoutError(message); } if (message == FingerprintJS.ERROR_RATE_LIMIT) { - // return RequestTimeoutError(message); ??????? + return TooManyRequestError(message); } if (message == FingerprintJS.ERROR_FORBIDDEN_ORIGIN) { return OriginNotAvailableError(message);