On the beta branch, when attempting to create a POST on behalf of a user, I use the API and provide the username as the
api_username. Because of the way I’m managing users, the user may not exist in Discourse at this time and I’d like to be able to respond to that exception by creating the user. It would be useful if the error had enough context to determine that this case occurred, but instead, it’s raising a Discourse::InvalidAccess and the server is returning a 500.
lib/auth/default_current_user_provider.rb:57:in `current_user' lib/current_user.rb:30:in `current_user' app/helpers/application_helper.rb:59:in `html_classes' app/views/layouts/application.html.erb:2:in `_app_views_layouts_application_html_erb__210758119167932006_91259420' app/controllers/application_controller.rb:496:in `build_not_found_page' app/controllers/application_controller.rb:134:in `rescue_discourse_actions' app/controllers/application_controller.rb:117:in `block in <class:ApplicationController>' config/initializers/100-quiet_logger.rb:13:in `call_with_quiet_assets' config/initializers/100-silence_logger.rb:26:in `call' lib/middleware/missing_avatars.rb:21:in `call' lib/middleware/turbo_dev.rb:33:in `call'
I can work around this, but it would be nice if the server responded with something in the 4xx range and enough information to determine the cause of the issue.