refactor(sentry): standardize exceptions to prevent Sentry minification

This commit is contained in:
dab246
2026-02-24 15:40:07 +07:00
committed by Dat H. Pham
parent 296548a781
commit 2e8a11e7eb
75 changed files with 1128 additions and 309 deletions
@@ -1,2 +1,8 @@
import 'package:core/domain/exceptions/app_base_exception.dart';
class NotFoundPersonalAccountException implements Exception {}
class NotFoundPersonalAccountException extends AppBaseException {
const NotFoundPersonalAccountException([super.message]);
@override
String get exceptionName => 'NotFoundPersonalAccountException';
}
@@ -1 +1,8 @@
class UnknownAddressException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class UnknownAddressException extends AppBaseException {
const UnknownAddressException([super.message]);
@override
String get exceptionName => 'UnknownAddressException';
}
@@ -1 +1,8 @@
class UnknownUriException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class UnknownUriException extends AppBaseException {
const UnknownUriException([super.message]);
@override
String get exceptionName => 'UnknownUriException';
}
@@ -1,7 +1,29 @@
class AccessTokenIsNullException implements Exception {}
import 'package:core/domain/exceptions/app_base_exception.dart';
class RefreshTokenIsNullException implements Exception {}
class AccessTokenIsNullException extends AppBaseException {
AccessTokenIsNullException([super.message]);
class TokenIdIsNullException implements Exception {}
@override
String get exceptionName => 'AccessTokenIsNullException';
}
class ExpiresTimeIsNullException implements Exception {}
class RefreshTokenIsNullException extends AppBaseException {
RefreshTokenIsNullException([super.message]);
@override
String get exceptionName => 'RefreshTokenIsNullException';
}
class TokenIdIsNullException extends AppBaseException {
TokenIdIsNullException([super.message]);
@override
String get exceptionName => 'TokenIdIsNullException';
}
class ExpiresTimeIsNullException extends AppBaseException {
ExpiresTimeIsNullException([super.message]);
@override
String get exceptionName => 'ExpiresTimeIsNullException';
}
+4 -4
View File
@@ -30,7 +30,7 @@ extension SessionExtension on Session {
} else if (downloadUrl.hasOrigin) {
downloadUrlValid = downloadUrl;
} else {
throw UnknownUriException();
throw const UnknownUriException();
}
var baseUrl = '${downloadUrlValid.origin}${downloadUrlValid.path}?${downloadUrlValid.query}';
@@ -56,7 +56,7 @@ extension SessionExtension on Session {
} else if (uploadUrl.hasOrigin) {
uploadUrlValid = uploadUrl;
} else {
throw UnknownUriException();
throw const UnknownUriException();
}
final baseUrl = '${uploadUrlValid.origin}${uploadUrlValid.path}';
@@ -109,7 +109,7 @@ extension SessionExtension on Session {
return username.value.isEmail ? username.value
: _getOwnEmailAddressFromPersonalAccount()
?? _getOwnEmailAddressFromPrincipalsCapability()
?? (throw UnknownAddressException());
?? (throw const UnknownAddressException());
}
String? _getOwnEmailAddressFromPersonalAccount() {
@@ -168,7 +168,7 @@ extension SessionExtension on Session {
return listPersonalAccount.first;
}
}
throw NotFoundPersonalAccountException();
throw const NotFoundPersonalAccountException();
}
AccountId get accountId => personalAccount.accountId;