import 'package:equatable/equatable.dart';
import 'package:{{#snakeCase}}{{project_name}}{{/snakeCase}}/core/enums/exception_type.dart';

abstract class AppException extends Equatable implements Exception {
  final String message;
  final AppExceptionType type;

  AppException(this.type, [String? message]) : message = message ?? type.name;

  @override
  List<Object?> get props => [message, type];

  @override
  String toString() => message;
}

class ClientException extends AppException {
  ClientException(super.type, [super.message]);

  @override
  String toString() => 'ClientException: ${super.toString()}';
}

class ServerException extends AppException {
  ServerException(super.type, [super.message]);

  @override
  String toString() => 'ServerException: ${super.toString()}';
}
