our $VERSION = '0.1';
our @EXPORT = qw( &get_database &get_lists_version &increment_lists_version
- &invalid_input );
+ &invalid_input exception );
use Dancer2::Plugin::DBIC;
}
sub invalid_input($details = undef) {
- status 400;
- return "Invalid input" . ( defined($details) ? " ($details)" : '' );
+ return exception 400,
+ "Invalid input" . ( defined($details) ? " ($details)" : '' );
+}
+
+sub exception($http_code, $text) {
+ status $http_code;
+ return { exception => $text };
}