class ApiException implements Exception {
  const ApiException({
    required this.message,
    this.code,
    this.statusCode,
    this.details,
  });

  final String message;
  final int? code;
  final int? statusCode;
  final Object? details;

  @override
  String toString() {
    final parts = <String>[
      if (statusCode != null) 'status=$statusCode',
      if (code != null) 'code=$code',
      message,
    ];
    return 'ApiException(${parts.join(', ')})';
  }
}
