fix: The code parameter must be propagated through the inheritance chain.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import 'package:tmail_ui_user/main/exceptions/remote/remote_exception.dart';
|
import 'package:tmail_ui_user/main/exceptions/remote/remote_exception.dart';
|
||||||
|
|
||||||
class AuthenticationException extends RemoteException {
|
class AuthenticationException extends RemoteException {
|
||||||
const AuthenticationException({super.message});
|
const AuthenticationException({super.code, super.message});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get exceptionName => 'AuthenticationException';
|
String get exceptionName => 'AuthenticationException';
|
||||||
@@ -19,6 +19,7 @@ class RefreshTokenFailedException extends AuthenticationException {
|
|||||||
int code = 400,
|
int code = 400,
|
||||||
String? message,
|
String? message,
|
||||||
}) : super(
|
}) : super(
|
||||||
|
code: code,
|
||||||
message: message ??
|
message: message ??
|
||||||
'Refresh token failed with status $code. Session invalid or revoked.',
|
'Refresh token failed with status $code. Session invalid or revoked.',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ class MockBaseController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SomeOtherException extends RemoteException {
|
class SomeOtherException extends RemoteException {
|
||||||
|
const SomeOtherException();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get exceptionName => 'SomeOtherException';
|
String get exceptionName => 'SomeOtherException';
|
||||||
}
|
}
|
||||||
@@ -145,7 +147,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should return false when exception is SomeOtherException', () {
|
test('should return false when exception is SomeOtherException', () {
|
||||||
expect(mockBaseController.validateUrgentException(SomeOtherException()), isFalse);
|
expect(mockBaseController.validateUrgentException(const SomeOtherException()), isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should return false when exception is null', () {
|
test('should return false when exception is null', () {
|
||||||
@@ -204,7 +206,7 @@ void main() {
|
|||||||
|
|
||||||
test('handleErrorViewState should called when error is SomeOtherException', () {
|
test('handleErrorViewState should called when error is SomeOtherException', () {
|
||||||
// arrange
|
// arrange
|
||||||
final error = SomeOtherException();
|
const error = SomeOtherException();
|
||||||
final stackTrace = StackTrace.current;
|
final stackTrace = StackTrace.current;
|
||||||
|
|
||||||
// act
|
// act
|
||||||
|
|||||||
Reference in New Issue
Block a user