pax_global_header 0000666 0000000 0000000 00000000064 14002030454 0014502 g ustar 00root root 0000000 0000000 52 comment=ae0a8a80eaba20bc9700962df08e37041f947f14
ruby-graphql-errors-0.4.0/ 0000775 0000000 0000000 00000000000 14002030454 0015432 5 ustar 00root root 0000000 0000000 ruby-graphql-errors-0.4.0/.gitignore 0000664 0000000 0000000 00000000177 14002030454 0017427 0 ustar 00root root 0000000 0000000 /.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
# rspec failure tracking
.rspec_status
ruby-graphql-errors-0.4.0/.rspec 0000664 0000000 0000000 00000000037 14002030454 0016547 0 ustar 00root root 0000000 0000000 --format documentation
--color
ruby-graphql-errors-0.4.0/.ruby-version 0000664 0000000 0000000 00000000006 14002030454 0020073 0 ustar 00root root 0000000 0000000 2.3.4
ruby-graphql-errors-0.4.0/.tool-versions 0000664 0000000 0000000 00000000013 14002030454 0020250 0 ustar 00root root 0000000 0000000 ruby 2.6.5
ruby-graphql-errors-0.4.0/.travis.yml 0000664 0000000 0000000 00000000420 14002030454 0017537 0 ustar 00root root 0000000 0000000 language: ruby
rvm:
- 2.3.8
env:
- COVERALLS_RUN_LOCALLY=true
before_install: gem install bundler -v '< 2'
matrix:
include:
- gemfile: graphql-1.7.gemfile
env: GRAPHQL_RUBY_VERSION=1_7
- gemfile: graphql-1.8.gemfile
env: GRAPHQL_RUBY_VERSION=1_8
ruby-graphql-errors-0.4.0/CHANGELOG.md 0000664 0000000 0000000 00000002451 14002030454 0017245 0 ustar 00root root 0000000 0000000 # Changelog
The following are lists of the notable changes included with each release.
This is intended to help keep people informed about notable changes between
versions, as well as provide a rough history. Each item is prefixed with
one of the following labels: `Added`, `Changed`, `Deprecated`,
`Removed`, `Fixed`, `Security`. We also use [Semantic Versioning](http://semver.org)
to manage the versions of this gem so
that you can set version constraints properly.
#### [Unreleased](https://github.com/exAspArk/graphql-errors/compare/v0.4.0...HEAD)
* WIP
#### [v0.4.0](https://github.com/exAspArk/graphql-errors/compare/v0.3.0...v0.4.0) – 2019-11-12
* `Added`: handle `rescue_from` Module arguments. [#19](https://github.com/exAspArk/graphql-errors/pull/19)
#### [v0.3.0](https://github.com/exAspArk/graphql-errors/compare/v0.2.0...v0.3.0) – 2018-12-17
* `Added`: handle errors from lazy resolvers. [#14](https://github.com/exAspArk/graphql-errors/pull/14)
#### [v0.2.0](https://github.com/exAspArk/graphql-errors/compare/v0.1.0...v0.2.0) – 2018-03-15
* `Added`: `object, argument, context` to rescue_from. [#8](https://github.com/exAspArk/graphql-errors/pull/8)
#### [v0.1.0](https://github.com/exAspArk/graphql-errors/compare/b24b18c...v0.1.0) – 2017-08-29
* `Added`: initial functional version.
ruby-graphql-errors-0.4.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000006232 14002030454 0020234 0 ustar 00root root 0000000 0000000 # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at exaspark@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
ruby-graphql-errors-0.4.0/Gemfile 0000664 0000000 0000000 00000000246 14002030454 0016727 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
gem 'pry'
gem 'graphql', '~> 1.8.4'
gem 'batch-loader', '~> 1.2'
# Specify your gem's dependencies in graphql-errors.gemspec
gemspec
ruby-graphql-errors-0.4.0/LICENSE.txt 0000664 0000000 0000000 00000002063 14002030454 0017256 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2017 exAspArk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
ruby-graphql-errors-0.4.0/README.md 0000664 0000000 0000000 00000007554 14002030454 0016724 0 ustar 00root root 0000000 0000000 # graphql-errors
[](https://travis-ci.org/exAspArk/graphql-errors)
[](https://coveralls.io/github/exAspArk/graphql-errors?branch=master)
[](https://rubygems.org/gems/graphql-errors)
[](https://rubygems.org/gems/graphql-errors)
This gem provides a simple error handling for [graphql-ruby](https://github.com/rmosolgo/graphql-ruby).
## Highlights
* Error handling for each field.
* Logic inside the `rescue_from` block, similarly to Rails.
* Catching exceptions by ancestors, e.g. `CustomError` with `rescue_from StandardError`.
* Per schema configuration.
* No dependencies.
## Usage
Once you defined your GraphQL schema:
```ruby
Schema = GraphQL::Schema.define do
query QueryType
end
```
You can add `rescue_from` error handlers with `GraphQL::Errors`. For example:
```ruby
GraphQL::Errors.configure(Schema) do
rescue_from ActiveRecord::RecordNotFound do |exception|
nil
end
rescue_from ActiveRecord::RecordInvalid do |exception|
GraphQL::ExecutionError.new(exception.record.errors.full_messages.join("\n"))
end
# uses Module to handle several similar errors with single rescue_from
rescue_from MyNetworkErrors do |_|
GraphQL::ExecutionError.new("Don't mind, just retry the mutation")
end
rescue_from StandardError do |exception|
GraphQL::ExecutionError.new("Please try to execute the query for this field later")
end
rescue_from CustomError do |exception, object, arguments, context|
error = GraphQL::ExecutionError.new("Error found!")
firstError.path = context.path + ["myError"]
context.add_error(firstError)
end
end
```
It'll handle exceptions raised from each resolver in the schema:
```ruby
QueryType = GraphQL::ObjectType.define do
name "Query"
field :post, PostType do
argument :id, !types.ID
resolve ->(obj, args, ctx) { Post.find(args['id']) } # <= will raise ActiveRecord::RecordNotFound
end
end
Schema.execute('query { post(id: "1") { title } }') # handles the error without failing the whole query
# => { data: { post: nil } }
```
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'graphql-errors'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install graphql-errors
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/exAspArk/graphql-errors. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Graphql::Errors project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/exAspArk/graphql-errors/blob/master/CODE_OF_CONDUCT.md).
ruby-graphql-errors-0.4.0/Rakefile 0000664 0000000 0000000 00000000165 14002030454 0017101 0 ustar 00root root 0000000 0000000 require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
ruby-graphql-errors-0.4.0/bin/ 0000775 0000000 0000000 00000000000 14002030454 0016202 5 ustar 00root root 0000000 0000000 ruby-graphql-errors-0.4.0/bin/console 0000775 0000000 0000000 00000000535 14002030454 0017575 0 ustar 00root root 0000000 0000000 #!/usr/bin/env ruby
require "bundler/setup"
require "graphql/errors"
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
require "irb"
IRB.start(__FILE__)
ruby-graphql-errors-0.4.0/bin/setup 0000775 0000000 0000000 00000000203 14002030454 0017263 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx
bundle install
# Do any other automated setup that you need to do here
ruby-graphql-errors-0.4.0/graphql-1.7.gemfile 0000664 0000000 0000000 00000000173 14002030454 0020726 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
gem "pry"
gem 'coveralls'
gem 'batch-loader', '~> 1.2'
gem "graphql", "~> 1.7.14"
gemspec
ruby-graphql-errors-0.4.0/graphql-1.8.gemfile 0000664 0000000 0000000 00000000172 14002030454 0020726 0 ustar 00root root 0000000 0000000 source "https://rubygems.org"
gem "pry"
gem 'coveralls'
gem 'batch-loader', '~> 1.2'
gem "graphql", "~> 1.8.4"
gemspec
ruby-graphql-errors-0.4.0/graphql-errors.gemspec 0000664 0000000 0000000 00000002200 14002030454 0021741 0 ustar 00root root 0000000 0000000 # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "graphql/errors/version"
Gem::Specification.new do |spec|
spec.name = "graphql-errors"
spec.version = GraphQL::Errors::VERSION
spec.authors = ["exAspArk"]
spec.email = ["exaspark@gmail.com"]
spec.summary = %q{Simple error handler for graphql-ruby}
spec.description = %q{Simple error handler for graphql-ruby}
spec.homepage = "https://github.com/exAspArk/graphql-errors"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.required_ruby_version = '>= 2.1.0' # keyword args
spec.add_runtime_dependency "graphql", ">= 1.6.0", "< 2"
spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "pry"
end
ruby-graphql-errors-0.4.0/images/ 0000775 0000000 0000000 00000000000 14002030454 0016677 5 ustar 00root root 0000000 0000000 ruby-graphql-errors-0.4.0/images/hyre.png 0000664 0000000 0000000 00000026737 14002030454 0020373 0 ustar 00root root 0000000 0000000 PNG
IHDR N pHYs .# .#x?v iTXtXML:com.adobe.xmp adobe:docid:photoshop:fe5ca78c-0d8e-c54e-b793-de583f94ec64 mQ &IDATxwՕs:LOE J 0,$ۻۋa0~3JFaHvxfXq8EJ8=GFD%ӯ5Tus=\QUBBB
#SYG CUr