talker_error_handler 0.5.0 copy "talker_error_handler: ^0.5.0" to clipboard
talker_error_handler: ^0.5.0 copied to clipboard

Error handler core package for talker (advanced error handler and logger package)

example/talker_error_handler_example.dart

import 'dart:developer';

import 'package:talker_error_handler/talker_error_handler.dart';

class HttpException implements Exception {}

void main() {
  final errorHandler = ErrorHandler(
    registeredErrors: {
      HttpException: ErrorLevel.critical,
    },
  );

  errorHandler.stream.debug.listen((error) {
    log('DEBUG ERROR');
    log(error.errorLevel.toString());
  });

  errorHandler.stream.critical.listen((error) {
    log('CRITICAl ERROR - $error');
    log(error.errorLevel.toString());
  });

  errorHandler
    ..handle(
      HttpException(),
      'Test custom exception',
    )
    ..handle(
      ArgumentError(),
      'Test error',
    )
    ..handle(
      Exception(),
      'Test critical exception',
      null,
      ErrorLevel.critical,
    );
}
3
likes
120
pub points
0%
popularity

Publisher

verified publisherfrezycode.com

Error handler core package for talker (advanced error handler and logger package)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on talker_error_handler