import 'package:wz_location_plugin/models/wayz_common_models.dart';

/// HTTP / JSON failure for [WzScenarioHttpApi].
class WzHttpException implements Exception {
  final int? statusCode;
  final String message;
  final WzApiError? apiError;
  final String? rawBody;

  WzHttpException({
    required this.message,
    this.statusCode,
    this.apiError,
    this.rawBody,
  });

  @override
  String toString() =>
      'WzHttpException($statusCode): $message${apiError != null ? ' [${apiError!.code}] ${apiError!.message}' : ''}';
}
