omeka / plugin-Scripto

Adds the ability to transcribe items using the Scripto library.
17 stars 11 forks source link

Scripto throws 500 errors on page action problems, better error handling needed. #27

Closed duspal closed 8 years ago

duspal commented 8 years ago

In IndexController.php, page actions are wrapped in a try block, with the catch block throwing a generic 500 error. Specifically, the error we had was:

exception 'Scripto_Service_Exception' with message 'You must confirm your email address before you can edit in /home/judygies/public_html/omeka/plugins/Scripto/libraries/Scripto/Service/MediaWiki.php:667

This is a common error which should have user feedback saying as much, barring this, have a more descriptive error message rather than just 500.

If not the above, and we wish to continue using 500 errors as a catch-all (for security reasons as an example), the error_log should at least be updated with a detailed line so that troubleshooters can quickly assess the nature of the problem.

Preferably, a combination of above should be implemented. Thanks!

jimsafley commented 8 years ago

Thanks for the report.

This error happens when MediaWiki is configured $wgEmailConfirmToEdit = true and the current user hasn't confirmed their email address using their MediaWiki user profile page. Ideally the "Edit transcription" button wouldn't even render, but there's no API request to check this configuration so the restriction isn't checked in Scripto_Document::canEditTranscriptionPage().

What I'm left with is to find some graceful way to report this (and any caught Scripto_Exception error) to the user.