• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wger-project / flutter / 14937570849

09 May 2025 08:55PM UTC coverage: 53.019% (-3.3%) from 56.285%
14937570849

push

github

rolandgeider
Also add link to exercise submission screen

0 of 5 new or added lines in 1 file covered. (0.0%)

540 existing lines in 15 files now uncovered.

5180 of 9770 relevant lines covered (53.02%)

1.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.56
/lib/exceptions/http_exception.dart
1
/*
2
 * This file is part of wger Workout Manager <https://github.com/wger-project>.
3
 * Copyright (C) 2020, 2021 wger Team
4
 *
5
 * wger Workout Manager is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Affero General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Affero General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Affero General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18

19
import 'dart:convert';
20

21
class WgerHttpException implements Exception {
22
  Map<String, dynamic> errors = {};
23

24
  /// Custom http exception.
25
  /// Expects the response body of the REST call and will try to parse it to
26
  /// JSON. Will use the response as-is if it fails.
27
  WgerHttpException(dynamic responseBody) {
2✔
28
    if (responseBody == null) {
29
      errors = {'unknown_error': 'An unknown error occurred, no further information available'};
×
30
    } else {
31
      try {
32
        final response = json.decode(responseBody);
2✔
33
        errors = (response is Map ? response : {'unknown_error': response}).cast<String, dynamic>();
6✔
34
      } catch (e) {
35
        errors = {'unknown_error': responseBody};
×
36
      }
37
    }
38
  }
39

40
  WgerHttpException.fromMap(Map<String, dynamic> map) {
2✔
41
    errors = map;
2✔
42
  }
43

UNCOV
44
  @override
×
45
  String toString() {
UNCOV
46
    return errors.values.toList().join(', ');
×
47
  }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc