module NulogyGraphqlApi::ErrorHandling

Private Instance Methods

render_error(exception) click to toggle source
# File lib/nulogy_graphql_api/error_handling.rb, line 23
def render_error(exception)
  error = if show_detailed_error_information?
    NulogyGraphqlApi::GraphQLError.new(exception.message, backtrace: exception.backtrace)
  else
    NulogyGraphqlApi::GraphQLError.new("Something went wrong")
  end

  render json: error.render, status: :internal_server_error
end
render_not_found() click to toggle source
# File lib/nulogy_graphql_api/error_handling.rb, line 33
def render_not_found
  render json: NulogyGraphqlApi::GraphQLError.new("Not Found").render, status: :not_found
end
render_timeout() click to toggle source
# File lib/nulogy_graphql_api/error_handling.rb, line 41
def render_timeout
  render json: NulogyGraphqlApi::GraphQLError.new("Request Timeout").render, status: :request_timeout
end
render_unauthorized() click to toggle source
# File lib/nulogy_graphql_api/error_handling.rb, line 37
def render_unauthorized
  render json: NulogyGraphqlApi::GraphQLError.new("Unauthorized").render, status: :unauthorized
end
show_detailed_error_information?() click to toggle source
# File lib/nulogy_graphql_api/error_handling.rb, line 19
def show_detailed_error_information?
  Rails.application.config.consider_all_requests_local
end