-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/pid1102 error reporting system (#328)
* Stacktrace stream manager * stacktrace step as stream and complete stacktrace as string * error trace * stacktrace/error reporting, added more events * changed name to StacktraceManager and added more stacktrace * stacktrace/error reporting, added more events * cleaned params passed to stacktrace from the usecases * hive db used to persist the stacktrace (preparation for next feature) * test fixed with injection of stack trace manager class * removed deprecated logger level trace v and wtf * resolve flutter analyzer issues * formatting
- Loading branch information
Showing
103 changed files
with
2,058 additions
and
1,038 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:hive/hive.dart'; | ||
import 'package:injectable/injectable.dart'; | ||
|
||
@lazySingleton | ||
class StacktraceManager { | ||
bool isEnabled = false; | ||
var box = Hive.box('stacktrace'); | ||
String _errorTrace = ''; | ||
StreamController<String> _stacktraceStreamController = | ||
StreamController<String>.broadcast(); | ||
|
||
StreamController<String> _errorStreamController = | ||
StreamController<String>.broadcast(); | ||
|
||
Stream<String> get stacktraceStream => _stacktraceStreamController.stream; | ||
|
||
Stream<String> get errorStream => _errorStreamController.stream; | ||
|
||
/// we reset the stream | ||
/// so we can use it again | ||
void reset() { | ||
_stacktraceStreamController.close(); | ||
_errorStreamController.close(); | ||
// we reset the stream | ||
_stacktraceStreamController = StreamController<String>.broadcast(); | ||
_errorStreamController = StreamController<String>.broadcast(); | ||
} | ||
|
||
/// we clear the stacktrace | ||
void clear() { | ||
box.clear(); | ||
_errorTrace = ''; | ||
_stacktraceStreamController.add(''); | ||
_errorStreamController.add(_errorTrace); | ||
} | ||
|
||
/// we close the stream | ||
void dispose() { | ||
_stacktraceStreamController.close(); | ||
_errorStreamController.close(); | ||
} | ||
|
||
/// we add a new trace to the stacktrace stream | ||
void addTrace(String stepDescription) { | ||
if (!isEnabled) return; | ||
//write string in an external txt file | ||
|
||
String _stacktrace = box.get('stacktrace') ?? ''; | ||
_stacktrace += stepDescription + '\n***\n***'; | ||
box.put('stacktrace', _stacktrace); | ||
_stacktraceStreamController.add(stepDescription); | ||
} | ||
|
||
void addError(String error) { | ||
_errorTrace += '\n***' + error + '\n***'; | ||
_errorStreamController.add(error); | ||
} | ||
|
||
/// get the stacktrace | ||
String get stacktrace { | ||
String _stacktrace = box.get('stacktrace') ?? ''; | ||
return _stacktrace; | ||
} | ||
|
||
/// get the error trace | ||
String get errorTrace => _errorTrace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
lib/credential/domain/use_cases/get_auth_claim_use_case.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.