diff --git a/Koha/Object.pm b/Koha/Object.pm index 2dc135e2d1..98867d29d0 100644 --- a/Koha/Object.pm +++ b/Koha/Object.pm @@ -143,6 +143,13 @@ sub store { duplicate_id => $+{key} ); } + elsif( $_->{msg} =~ /Incorrect (?\w+) value: '(?.*)' for column '(?\w+)'/ ) { + Koha::Exceptions::Object::BadValue->throw( + type => $+{type}, + value => $+{value}, + property => $+{property} + ); + } } # Catch-all for foreign key breakages. It will help find other use cases $_->rethrow();