getErrorMessageAPI method
Implementation
String getErrorMessageAPI({required int code, required String msg}) {
switch ('$code') {
case '${HttpStatus.badRequest}':// -S400_BAD_REQUEST
return '${tr('ERROR_API_S400_BAD_REQUEST')}';
case '${HttpStatus.unauthorized}':// -S401_UNAUTHORIZED
return '${tr('ERROR_API_S401_UNAUTHORIZED')}';
case '${HttpStatus.notFound}':// -S404_NOT_FOUND
return '${tr('ERROR_API_S404_NOT_FOUND')}';
case '${HttpStatus.serviceUnavailable}':// -S503_SERVICE_UNAVAILABLE
return '${tr('ERROR_API_S503_SERVICE_UNAVAILABLE')}';
case '${HttpStatus.ok}':// -S200_OK // msg_operation_success
return '${tr('ERROR_API_S200_OK')}';
default:
return '${tr('msg_TraitementImpossible')}\nmsg $msg';
}
}