<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[627] trunk/alexandria/lib/alexandria: - Improved error messages</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>627</dd>
<dt>Author</dt> <dd>laurusnobilis</dd>
<dt>Date</dt> <dd>2007-02-28 04:20:01 -0500 (Wed, 28 Feb 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>- Improved error messages
- ignored empty lines when importing a library

M    lib/alexandria/book_providers.rb
M    lib/alexandria/import_library.rb
M    lib/alexandria/ui/main_app.rb</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkalexandrialibalexandriabook_providersrb">trunk/alexandria/lib/alexandria/book_providers.rb</a></li>
<li><a href="#trunkalexandrialibalexandriaimport_libraryrb">trunk/alexandria/lib/alexandria/import_library.rb</a></li>
<li><a href="#trunkalexandrialibalexandriauimain_apprb">trunk/alexandria/lib/alexandria/ui/main_app.rb</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkalexandrialibalexandriabook_providersrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/book_providers.rb (626 => 627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/book_providers.rb        2007-02-26 20:06:56 UTC (rev 626)
+++ trunk/alexandria/lib/alexandria/book_providers.rb        2007-02-28 09:20:01 UTC (rev 627)
</span><span class="lines">@@ -245,21 +245,21 @@
</span><span class="cx">         begin
</span><span class="cx">             require 'alexandria/book_providers/amazon'
</span><span class="cx">         rescue LoadError
</span><del>-            puts &quot;can't load Ruby/Amazon: provider Amazon not available&quot;
</del><ins>+            puts &quot;Can't load Ruby/Amazon, hence provider Amazon not available&quot;
</ins><span class="cx">         end
</span><span class="cx">         
</span><span class="cx">         # mechanize is optional
</span><span class="cx">         begin
</span><span class="cx">             require 'alexandria/book_providers/dea_store_it'
</span><span class="cx">         rescue LoadError
</span><del>-            puts &quot;can't load mechanize: provider Deastore not available&quot;
</del><ins>+            puts &quot;Can't load mechanize, hence provider Deastore not available&quot;
</ins><span class="cx">         end
</span><span class="cx">         
</span><span class="cx">         # Ruby/ZOOM is optional
</span><span class="cx">         begin
</span><span class="cx">             require 'alexandria/book_providers/z3950'
</span><span class="cx">         rescue LoadError
</span><del>-            puts &quot;can't load Ruby/ZOOM: Z39.50 and providers Library of Congress, British Library not available&quot;
</del><ins>+            puts &quot;Can't load Ruby/ZOOM, hence Z39.50 and providers Library of Congress, British Library not available&quot;
</ins><span class="cx">         end
</span><span class="cx"> 
</span><span class="cx">         attr_reader :abstract_classes
</span></span></pre></div>
<a id="trunkalexandrialibalexandriaimport_libraryrb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/import_library.rb (626 => 627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/import_library.rb        2007-02-26 20:06:56 UTC (rev 626)
+++ trunk/alexandria/lib/alexandria/import_library.rb        2007-02-28 09:20:01 UTC (rev 627)
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx">                     puts &quot;Trying line #{line}&quot;
</span><span class="cx">                     # Let's preserve the failing isbns so we can report them later.
</span><span class="cx">                     begin
</span><del>-                        [line.chomp, canonicalise_isbn(line.chomp)] 
</del><ins>+                        [line.chomp, canonicalise_isbn(line.chomp)] unless line == &quot;\n&quot;
</ins><span class="cx">                 rescue =&gt; e
</span><span class="cx">                         puts e.message 
</span><span class="cx">                         [line.chomp, nil]
</span></span></pre></div>
<a id="trunkalexandrialibalexandriauimain_apprb"></a>
<div class="modfile"><h4>Modified: trunk/alexandria/lib/alexandria/ui/main_app.rb (626 => 627)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/alexandria/lib/alexandria/ui/main_app.rb        2007-02-26 20:06:56 UTC (rev 626)
+++ trunk/alexandria/lib/alexandria/ui/main_app.rb        2007-02-28 09:20:01 UTC (rev 627)
</span><span class="lines">@@ -1205,11 +1205,11 @@
</span><span class="cx">             on_import = proc do 
</span><span class="cx">                 ImportDialog.new(@main_app) do |library, bad_isbns|
</span><span class="cx">                         unless bad_isbns.empty?
</span><del>-                                message = &quot;The following ISBNs failed to import:&quot;
</del><ins>+                                message = &quot;The following lines are not valid ISBNs and were not imported:&quot;
</ins><span class="cx">                                 bad_isbns.each {|bi| message += &quot;\n#{bi}&quot;}
</span><span class="cx">                                 bad_isbn_warn = Gtk::MessageDialog.new(@main_app, Gtk::Dialog::MODAL, Gtk::MessageDialog::WARNING,  Gtk::MessageDialog::BUTTONS_CLOSE, message ).show
</span><span class="cx">                                 bad_isbn_warn.signal_connect('response') { bad_isbn_warn.destroy }
</span><del>-                                         #quick_message(&quot;The following ISBNs failed to import: #{bad_isbns.inspect}&quot;)
</del><ins>+                                         #quick_message(&quot;The following lines are not valid ISBNs and were not imported: #{bad_isbns.inspect}&quot;)
</ins><span class="cx">                         end 
</span><span class="cx">                     @libraries.add_library(library)
</span><span class="cx">                     append_library(library, true)
</span></span></pre>
</div>
</div>

</body>
</html>