redstone_exception_mapper 0.0.1 copy "redstone_exception_mapper: ^0.0.1" to clipboard
redstone_exception_mapper: ^0.0.1 copied to clipboard

Dart 1 only

A plugin for Redstone.dart to map unhandled exceptions to shelf Responses.

Redstone exception mapper plugin #

Usage #

  • Add redstone_exception_mapper to your pubspec.yaml.
  • Import the plugin import 'package:redstone_exception_mapper/redstone_exception_mapper.dart' as plugin;
  • Add this line before the setup() call of Redstone : app.addPlugin(plugin.ExceptionMapperPlugin);
  • (Optional) You may turn off Redstone's error pages : app.showErrorPage = false;
  • Map your exceptions to a function returning a new shelf Response.
  plugin.mappings = {
    NotFoundException: (NotFoundException e) => new Response.notFound(e.message)
  };
0
likes
30
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

A plugin for Redstone.dart to map unhandled exceptions to shelf Responses.

License

BSD-3-Clause (license)

Dependencies

redstone, shelf

More

Packages that depend on redstone_exception_mapper