Commit 87a0c544 authored by Stan Hu's avatar Stan Hu

Merge branch 'cablett-graphql-errors' into 'master'

Add GraphQL error for test/dev

See merge request gitlab-org/gitlab!48566
parents a00cef02 688c0414
......@@ -37,7 +37,11 @@ class GraphqlController < ApplicationController
rescue_from StandardError do |exception|
log_exception(exception)
render_error("Internal server error")
if Rails.env.test? || Rails.env.development?
render_error("Internal server error: #{exception.message}")
else
render_error("Internal server error")
end
end
rescue_from Gitlab::Graphql::Variables::Invalid do |exception|
......
......@@ -32,7 +32,9 @@ RSpec.describe 'Creating a DAST Site Profile' do
allow(DastSiteProfile).to receive(:create!).and_raise(StandardError)
end
it_behaves_like 'a mutation that returns top-level errors', errors: ['Internal server error']
it_behaves_like 'a mutation that returns top-level errors' do
let(:match_errors) { contain_exactly(include('Internal server error')) }
end
end
end
end
......@@ -38,7 +38,9 @@ RSpec.describe 'Creating a DAST Site Profile' do
dast_site_profile.destroy!
end
it_behaves_like 'a mutation that returns top-level errors', errors: ['Internal server error']
it_behaves_like 'a mutation that returns top-level errors' do
let(:match_errors) { contain_exactly(include("Internal server error: Couldn't find DastSiteProfile")) }
end
end
context 'when wrong type of global id is passed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment