summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/BLua.cc8
-rw-r--r--lib/Handle.cc10
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc
index 1166915..95519a1 100644
--- a/lib/BLua.cc
+++ b/lib/BLua.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.cc,v 1.17 2003-12-26 23:51:33 pixel Exp $ */
+/* $Id: BLua.cc,v 1.18 2004-05-01 11:48:57 pixel Exp $ */
#include <lualib.h>
@@ -27,8 +27,6 @@
#define BUFFERSIZE 2048
#endif
-typedef GeneralException LuaException;
-
class LuaStatics : public Base {
public:
static const char * getF(lua_State *, void *, size_t *);
@@ -619,3 +617,7 @@ void LuaObject::pushdestruct(Lua * L) throw (GeneralException) {
wantdestruct = true;
}
+
+LuaException::LuaException(String fn) : GeneralException(fn) { }
+
+LuaException::LuaException() { }
diff --git a/lib/Handle.cc b/lib/Handle.cc
index fe58b48..9f369ce 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Handle.cc,v 1.69 2004-04-30 08:21:36 pixel Exp $ */
+/* $Id: Handle.cc,v 1.70 2004-05-01 11:48:57 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -102,6 +102,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) {
ssize_t r, tr = 0;
bool done, full = false;
const char * buf = (const char *)cbuf;
+
+ if (closed) {
+ throw IOGeneral("Unable to write: handle `" + GetName() + "' is closed.");
+ }
if (!count)
return 0;
@@ -151,6 +155,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) {
ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) {
ssize_t r;
+ if (closed) {
+ throw IOGeneral("Unable to read: handle `" + GetName() + "' is closed.");
+ }
+
if (!count)
return 0;