Skip to content

Commit

Permalink
fix: add error to AliceLog (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse authored Jun 22, 2024
1 parent 7eace3e commit 60a059b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/alice_chopper/lib/alice_chopper_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import 'dart:async' show FutureOr;
import 'dart:convert' show utf8;
import 'dart:io' show HttpHeaders;

import 'package:flutter/foundation.dart';
import 'package:alice/core/alice_adapter.dart';
import 'package:alice/core/alice_utils.dart';
import 'package:alice/model/alice_http_call.dart';
import 'package:alice/model/alice_http_error.dart';
import 'package:alice/model/alice_http_request.dart';
import 'package:alice/model/alice_http_response.dart';
import 'package:alice/model/alice_log.dart';
import 'package:chopper/chopper.dart';
import 'package:http/http.dart' as http;
import 'package:uuid/uuid.dart';
Expand Down Expand Up @@ -101,6 +103,13 @@ class AliceChopperAdapter with AliceAdapter implements Interceptor {
/// Log error to Alice log
AliceUtils.log(error.toString());

aliceCore.addLog(AliceLog(
message: error.toString(),
level: DiagnosticLevel.error,
error: error,
stackTrace: stackTrace,
));

/// Add empty response to Alice core
aliceCore.addResponse(
AliceHttpResponse()..status = -1,
Expand Down

0 comments on commit 60a059b

Please sign in to comment.