From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ag:master commit in: /
Date: Wed, 25 Feb 2015 23:54:42 +0000 (UTC) [thread overview]
Message-ID: <1424908476.face39b1a3a32f3a9a49747059dac1484025458d.robbat2@gentoo> (raw)
commit: face39b1a3a32f3a9a49747059dac1484025458d
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 25 23:54:36 2015 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Feb 25 23:54:36 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=face39b1
Improve error handling.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
ag | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/ag b/ag
index f3c106e..5602df5 100755
--- a/ag
+++ b/ag
@@ -51,14 +51,14 @@ op = OptionParser.new do |opts|
$options.action = :do_delete_msg
end
-
+
opts.on('--create-index', 'Create index but do not populate. Needs --list') do
abort 'Can only select one action' if $options.action != nil
$options.action = :do_create_index
$options.need_argument = false
end
-
+
opts.on('--rethread', 'Rethread messages. Needs --list') do
abort 'Can only select one action' if $options.action != nil
@@ -215,22 +215,27 @@ def do_delete_msg
end
end
-def do_delete_index(ignore_missing: false)
+def do_delete_index(ignore_missing: false, _raise: false)
begin
Ag::Storage.delete_index($options.name)
rescue Elasticsearch::Transport::Transport::Errors::NotFound => e
- $stderr.puts "Index does not exist: #{e}" unless ignore_missing
+ unless ignore_missing
+ raise e if _raise
+ $stderr.puts "Index does not exist: #{e}"
+ end
rescue => e
+ raise e if _raise
$stderr.puts "Cannot delete index: #{e}"
end
end
-def do_create_index(ignore_exists: false)
+def do_create_index(ignore_exists: false, _raise: false)
begin
Ag::Storage.create_index($options.name)
rescue Elasticsearch::Transport::Transport::Errors::BadRequest => e
- if ignore_exists and e !~ /IndexAlreadyExistsException/
- raise e
+ unless (ignore_exists and e.message =~ /IndexAlreadyExistsException/)
+ raise e if _raise
+ $stderr.puts "Cannot create index #{e}"
end
end
end
next reply other threads:[~2015-02-25 23:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 23:54 Robin H. Johnson [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-03-07 21:06 [gentoo-commits] proj/ag:master commit in: / Alex Legler
2015-03-07 20:55 Alex Legler
2015-03-04 15:12 Alex Legler
2015-03-04 14:38 git@oystercatcher mirror+tproxy
2015-03-04 14:38 Alex Legler
2015-02-26 0:00 Robin H. Johnson
2015-02-25 23:57 Robin H. Johnson
2015-02-25 23:48 Robin H. Johnson
2015-02-25 23:40 Robin H. Johnson
2015-02-25 23:40 Robin H. Johnson
2015-02-25 23:40 Robin H. Johnson
2015-02-24 4:21 Robin H. Johnson
2015-02-24 4:21 Robin H. Johnson
2015-02-24 3:05 Robin H. Johnson
2015-02-24 2:57 Robin H. Johnson
2015-02-24 2:47 Robin H. Johnson
2015-02-24 2:46 Robin H. Johnson
2015-02-24 2:18 Robin H. Johnson
2015-02-24 2:17 Robin H. Johnson
2015-02-24 2:02 Robin H. Johnson
2015-02-23 23:55 Alex Legler
2015-02-23 22:48 Robin H. Johnson
2015-02-23 22:45 Robin H. Johnson
2015-02-23 21:05 Alex Legler
2015-02-23 20:59 Alex Legler
2015-02-23 20:59 Alex Legler
2015-02-21 21:59 Alex Legler
2015-02-21 21:52 Robin H. Johnson
2015-02-21 21:52 Robin H. Johnson
2015-02-21 21:52 Robin H. Johnson
2015-02-21 21:45 Robin H. Johnson
2015-02-21 18:57 Alex Legler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424908476.face39b1a3a32f3a9a49747059dac1484025458d.robbat2@gentoo \
--to=robbat2@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox