Skip to content

Commit

Permalink
change application schema (#142)
Browse files Browse the repository at this point in the history
Co-authored-by: Evgeniy Esaulkov <58729845+EvgeniyEsaulkov@users.noreply.github.com>
  • Loading branch information
AleksandrSeleznev and EvgeniyEsaulkov committed Apr 15, 2021
1 parent 86418bb commit 8d7ad87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/graphql/application_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ class ApplicationSchema < GraphQL::Schema
use GraphQL::Pagination::Connections
use GraphQL::Analysis::AST
use GraphQL::Batch
use GraphQL::Execution::Errors

rescue_from(ActiveRecord::RecordNotFound) do |_err, _obj, _args, _ctx, field|
raise GraphQL::ExecutionError.new("#{field.type.unwrap.graphql_name} not found",
extensions: { message: "Not Found", status: 404, code: :not_found })
end
end

0 comments on commit 8d7ad87

Please sign in to comment.