When developing, sometimes you might run your code to check how it works.
At that time, you might see an exception you didn't expect before.
What's next?
If I were you, I would google with the error message to find blog posts and documents dealing with the exception.
You too?
Today I released new version of Undine 🎉 : Undine
adds a termination process at exit to open google search with error message of exception unrescued in your Ruby code.
Undine
Undine is a gem to help your development experience: When an exception unrescued in your code is raised, opens google search with the errror message in your browser.
Installation
Add this line to your application's Gemfile:
gem 'undine', group: :development
And then execute:
bundle install
Or install it yourself as:
gem install undine
Usage
Just require 'undine'
and Undine.load
. That's it.
Example
require 'undine'
Undine.load
def something_function
'hoge'.foo
rescue => e
warn e.message
raise e
end
something_function
Undine.load
registers a post process to catch an unrescued exception and google its message.
In this code, NoMethodError
raises as String
does not have foo
method.
As executing this code, you are going to see google search page with the error message: https://www.google.com/search?q=undefined+method+%60foo%27+for+%22hoge%22%3AString%0ADid+you+mean%3F++for
Configuration
Undine.configure
is for users to customize behavior of Undine
.
The method gives a given block Undine::Configuration
object.
Undine
…Installation
gem install undine
Or if your app uses bundler add the following line to Gemfile:
gem 'undine', group: :development
Usage
Undine.load
registers a process to be executed at exit.
The process checks existence of exception unrescued in your code and open your browser to google with message of the exception as keyword.
Here is sample code:
require 'undine'
Undine.load
def something_function
'hoge'.foo
rescue => e
warn e.message
raise e
end
something_function
In this code, something_function
raises NoMethodError
and the exception is not rescued.
The process registered by Undine.load
catches it and generates a query from the exception object, in default, just calls the exception's message
.
The query is as follows:
Welcome Bug reports, feature requests and pull-requests!
I'm going to welcome any issue and pull-request 👍
Please open new issue or pull-request at the repo.
Top comments (0)