OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[41310] Avoid outputting internal statement errors
Oliver Günther5ce926208e92
diff --git a/lib/api/errors/internal_error.rb b/lib/api/errors/internal_error.rbindex c1555476301..69fdb08112f 100644--- a/lib/api/errors/internal_error.rb+++ b/lib/api/errors/internal_error.rb@@ -34,15 +34,31 @@ module APIidentifier 'InternalServerError'code 500- def initialize(error_message = nil, **)+ def initialize(error_message = nil, exception: nil, **)error = I18n.t('api_v3.errors.code_500')- if error_message+ if error_message && visible_exception?(exception)error += " #{error_message}"endsuper errorend++ private++ ##+ # Hide internal database errors in production+ def visible_exception?(exception)+ exception_blacklist.none? do |clz|+ exception.is_a?(clz)+ end+ end++ def exception_blacklist+ [+ ActiveRecord::StatementInvalid+ ]+ endendendend