errorMessage method
String
errorMessage(
- BuildContext context, {
- String? badRequestMessage,
- String? unauthorizedMessage,
- String? paymentRequiredMessage,
- String? loginFailedMessage,
- String? unauthenticatedMessage,
- String? forbiddenMessage,
- String? notFoundMessage,
- String? methodNotAllowedMessage,
- String? notAcceptableMessage,
- String? internalServerErrorMessage,
- String? notImplementedMessage,
- String? badGatewayMessage,
Implementation
String errorMessage(
BuildContext context, {
String? badRequestMessage,
String? unauthorizedMessage,
String? paymentRequiredMessage,
String? loginFailedMessage,
String? unauthenticatedMessage,
String? forbiddenMessage,
String? notFoundMessage,
String? methodNotAllowedMessage,
String? notAcceptableMessage,
String? internalServerErrorMessage,
String? notImplementedMessage,
String? badGatewayMessage,
}) {
switch (type) {
case ErrorType.badRequest:
return badRequestMessage ?? type.rawValue(context);
case ErrorType.unauthorized:
return unauthenticatedMessage ?? type.rawValue(context);
case ErrorType.paymentRequired:
return paymentRequiredMessage ?? type.rawValue(context);
case ErrorType.loginFailed:
return loginFailedMessage ?? type.rawValue(context);
case ErrorType.unauthenticated:
return unauthenticatedMessage ?? type.rawValue(context);
case ErrorType.unknown:
return message ?? type.rawValue(context);
case ErrorType.forbidden:
return forbiddenMessage ?? type.rawValue(context);
case ErrorType.notFound:
return notFoundMessage ?? type.rawValue(context);
case ErrorType.methodNotAllowed:
return methodNotAllowedMessage ?? type.rawValue(context);
case ErrorType.notAcceptable:
return notAcceptableMessage ?? type.rawValue(context);
case ErrorType.internalServerError:
return internalServerErrorMessage ?? type.rawValue(context);
case ErrorType.notImplemented:
return notImplementedMessage ?? type.rawValue(context);
case ErrorType.badGateway:
return badGatewayMessage ?? type.rawValue(context);
default:
return "Unknown Error Message";
}
}