https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330
--- Comment #30 from Jonathan Druart <jonathan.dru...@bugs.koha-community.org> --- (In reply to Benjamin Rokseth from comment #26) > (In reply to Jonathan Druart from comment #21) > > Are you sure we want to raise such specific error like "library does not > > exist" or "category does not exist"? > > I'd go for an eval { $patron->store } and return a 500 if something went > > wrong. > > > Well, yes and no. If missing category or branch is not part of error > response, it is no good. API user must not be expected to know about koha > internal dependencies, so a generic internal server response is not a good > option. > > That being said, the Patron object is probably the best place to handle > exceptions, e.g. Bug 16907. So if patron->store gives the needed feedback, > it is no point duplicating code/logic in api. > > So yes, I agree, but am a bit unsure about alternatives? Actually if you call $patron->store and a FK is wrong/missing, DBIx::Class will raise the relevant DBI error, something like: DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_ut`.`borrowers`, CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`)). That's why I think we should not handle it somewhere else. Of course it would be better to get something more readable for the response :) Did you mean we have to answer "This branchcode XYZ does not exist" or something like "One of the parameter is wrong/missing" would be enough? -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/