From 5ade66d0aa29a2fed034a93326a49b2edcd2e7ec Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Fri, 28 Oct 2005 00:07:56 +0000 Subject: [PATCH] Exceptions --- src/btree.cpp | 8 +++++++- src/main.cpp | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/btree.cpp b/src/btree.cpp index fff8278..ddcb14c 100644 --- a/src/btree.cpp +++ b/src/btree.cpp @@ -54,7 +54,13 @@ void BTree::WriteBlock (uchar *block, uint num) void BTree::AddKey (const Clave &k) { uint left, right; - Clave *kout = AddKeyR (k.Clone (), 0, left, right); + Clave *kout; + + try { + kout = AddKeyR (k.Clone (), 0, left, right); + } catch (Exception *e) { + throw e; + } if (kout) { unsigned short level; diff --git a/src/main.cpp b/src/main.cpp index 069b3ac..13d7c34 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,6 +37,11 @@ int main (int argc, char *argv[]) if (!km.Size() // si no tenemos claves agregadas, mejor que hagamos un alta || l >= paltas) { tree.AddKey (c); + try { + tree.AddKey (c); + } catch (Exception *e) { + std::cout << e->Message () << std::endl; + } km.AddValue (*it); it++; } else { -- 2.43.0