From fd54b20b922c81effede6f49d255a5b45031785c Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 5 Jan 2022 12:18:23 +1100 Subject: [PATCH] Reduce error reporting on permission check errors --- lib/api.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/api.dart b/lib/api.dart index df44196b..b58b620f 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -488,7 +488,16 @@ class InvenTreeAPI { List perms = List.from(roles[role] as List); return perms.contains(permission); } catch (error, stackTrace) { - sentryReportError(error, stackTrace); + if (error is CastError) { + // Ignore CastError + } else if (error is TypeError) { + // Ignore TypeError + } else { + // Unknown error - report it! + sentryReportError(error, stackTrace); + } + + // Unable to determine permission - assume true? return true; } }