<commit_before>import 'dart:async';
import 'dart:io';

import 'package:dartz/dartz.dart';
import 'package:meta/meta.dart';

import '../../../../core/error/exception.dart';
import '../../../../core/error/failure.dart';
import '../../../../core/network/network_info.dart';
import '../../domain/repositories/register_device_repository.dart';
import '../datasources/register_device_data_source.dart';

class RegisterDeviceRepositoryImpl implements RegisterDeviceRepository {
  final RegisterDeviceDataSource dataSource;
  final NetworkInfo networkInfo;

  RegisterDeviceRepositoryImpl({
    @required this.dataSource,
    @required this.networkInfo,
  });

  @override
  Future<Either<Failure, Map>> call({
    @required String connectionProtocol,
    @required String connectionDomain,
    @required String connectionPath,
    @required String deviceToken,
    bool clearOnesignalId,
  }) async {
    if (await networkInfo.isConnected) {
      try {
        final result = await dataSource(
          connectionProtocol: connectionProtocol,
          connectionDomain: connectionDomain,
          connectionPath: connectionPath,
          deviceToken: deviceToken,
          clearOnesignalId: clearOnesignalId,
        );
        return Right(result);
      } on ServerException {
        return Left(ServerFailure());
      } on SocketException {
        return Left(SocketFailure());
      } on TlsException {
        return Left(TlsFailure());
      } on FormatException {
        return Left(UrlFormatFailure());
      } on ArgumentError {
        return Left(UrlFormatFailure());
      } on TimeoutException {
        return Left(TimeoutFailure());
      }
    } else {
      return Left(ConnectionFailure());
    }
  }
}<commit_msg>Fix missing exceptions catch for register device.<commit_after>import 'dart:async';
import 'dart:io';

import 'package:dartz/dartz.dart';
import 'package:meta/meta.dart';

import '../../../../core/error/exception.dart';
import '../../../../core/error/failure.dart';
import '../../../../core/network/network_info.dart';
import '../../domain/repositories/register_device_repository.dart';
import '../datasources/register_device_data_source.dart';

class RegisterDeviceRepositoryImpl implements RegisterDeviceRepository {
  final RegisterDeviceDataSource dataSource;
  final NetworkInfo networkInfo;

  RegisterDeviceRepositoryImpl({
    @required this.dataSource,
    @required this.networkInfo,
  });

  @override
  Future<Either<Failure, Map>> call({
    @required String connectionProtocol,
    @required String connectionDomain,
    @required String connectionPath,
    @required String deviceToken,
    bool clearOnesignalId,
  }) async {
    if (await networkInfo.isConnected) {
      try {
        final result = await dataSource(
          connectionProtocol: connectionProtocol,
          connectionDomain: connectionDomain,
          connectionPath: connectionPath,
          deviceToken: deviceToken,
          clearOnesignalId: clearOnesignalId,
        );
        return Right(result);
      } on SettingsException {
        return Left(SettingsFailure());
      } on ServerException {
        return Left(ServerFailure());
      } on SocketException {
        return Left(SocketFailure());
      } on TlsException {
        return Left(TlsFailure());
      } on FormatException {
        return Left(UrlFormatFailure());
      } on ArgumentError {
        return Left(UrlFormatFailure());
      } on TimeoutException {
        return Left(TimeoutFailure());
      } on JsonDecodeException {
        return Left(JsonDecodeFailure());
      }
    } else {
      return Left(ConnectionFailure());
    }
  }
}
{'fraction_non_alphanumeric': 0.11692223439211391, 'fraction_numerical': 0.0, 'mean_word_length': 3.049889135254989, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6990011', 'n_tokens_mistral': 953, 'n_tokens_neox': 951, 'n_words': 212}