summaryrefslogtreecommitdiff
path: root/src/Handle.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-12-04 01:19:09 -0800
committerPixel <pixel@nobis-crew.org>2011-12-04 01:20:10 -0800
commitd440c3f50a918a932293ad98bcec96eaa4683222 (patch)
tree33e8e42a8e4506ae9da70cdb44dd133bde7f7219 /src/Handle.cc
parente5577eb7a643ce7885e5d14660a6d24254161622 (diff)
Reworked some things in the architecture, mainly exceptions and asserts.
-) Removed Assert() -) Added AAssert(), IAssert(), RAssert(), TAssert() and Failure() -) Reworked all asserts in the code, and added meaningful messages to them. -) Changed the way the startup code is generated; BALAU_STARTUP is no longer necessary.
Diffstat (limited to 'src/Handle.cc')
-rw-r--r--src/Handle.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Handle.cc b/src/Handle.cc
index b8dd45e..f3444d6 100644
--- a/src/Handle.cc
+++ b/src/Handle.cc
@@ -44,7 +44,7 @@ void eioInterface::doStart() {
Balau::Printer::elog(Balau::E_HANDLE, "Starting the eio interface");
Balau::TaskMan * taskMan = Balau::TaskMan::getDefaultTaskMan();
- Assert(taskMan);
+ IAssert(taskMan, "The eio interface shouldn't have started before the task manager");
struct ev_loop * loop = taskMan->getLoop();
m_repeat.set(loop);
@@ -162,7 +162,7 @@ off_t Balau::Handle::wtell() throw (GeneralException) {
bool Balau::SeekableHandle::canSeek() { return true; }
void Balau::SeekableHandle::rseek(off_t offset, int whence) throw (GeneralException) {
- Assert(canRead() || canWrite());
+ AAssert(canRead() || canWrite(), "Can't use a SeekableHandle with a Handle that can neither read or write...");
off_t size;
if (!canRead())
wseek(offset, whence);
@@ -185,7 +185,7 @@ void Balau::SeekableHandle::rseek(off_t offset, int whence) throw (GeneralExcept
}
void Balau::SeekableHandle::wseek(off_t offset, int whence) throw (GeneralException) {
- Assert(canRead() || canWrite());
+ AAssert(canRead() || canWrite(), "Can't use a SeekableHandle with a Handle that can neither read or write...");
off_t size;
if (!canWrite())
rseek(offset, whence);
@@ -208,14 +208,14 @@ void Balau::SeekableHandle::wseek(off_t offset, int whence) throw (GeneralExcept
}
off_t Balau::SeekableHandle::rtell() throw (GeneralException) {
- Assert(canRead() || canWrite());
+ AAssert(canRead() || canWrite(), "Can't use a SeekableHandle with a Handle that can neither read or write...");
if (!canRead())
return wtell();
return m_rOffset;
}
off_t Balau::SeekableHandle::wtell() throw (GeneralException) {
- Assert(canRead() || canWrite());
+ AAssert(canRead() || canWrite(), "Can't use a SeekableHandle with a Handle that can neither read or write...");
if (!canWrite())
return rtell();
return m_wOffset;
@@ -241,7 +241,7 @@ static int eioDone(eio_req * req) {
int Balau::FileSystem::mkdir(const char * path) throw (GeneralException) {
cbResults_t cbResults;
eio_req * r = eio_mkdir(path, 0755, 0, eioDone, &cbResults);
- Assert(r != 0);
+ RAssert(r != NULL, "eio_mkdir returned a NULL eio_req");
Task::yield(&cbResults.evt);
char str[4096];