Project

General

Profile

Actions

Feature #6184

closed
MP MP

know your dbo class on null

Feature #6184: know your dbo class on null

Added by Mark Petryk almost 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
12/08/2017
Due date:
% Done:

0%

Estimated time:

Description

It would be handy to know which Dbo class it is that's reporting that it does not have an active transaction. So I hacked and tested this in to the library.

379 template <class C>
380 const C *ptr<C>::operator->() const
381 {
382   const C *v = get();
383 
384   if (!v)
385     throw Exception("Wt::Dbo::ptr: null dereference " + std::string(typeid(C).name()) );
386 
387   return v;
388 }

MP Updated by Mark Petryk almost 9 years ago Actions #1

Rather, this reports that a ptr object is null, which is helpful... but, as far as "no active transaction", something like this similar there would be helpful as well.

RS Updated by Roel Standaert over 8 years ago Actions #2

  • Target version changed from 3.3.10 to 3.3.11

RS Updated by Roel Standaert about 8 years ago Actions #3

  • Status changed from New to Closed

MP Updated by Mark Petryk about 8 years ago Actions #4

I would do it on these two as well:

453 template ·
454 const C& ptr::operator*() const·
455 {·
456 if (obj_
457 return *obj_->obj();·
458 else·
459 throw Exception("Wt::Dbo::ptr: null dereference");·
460 }·
461 ·
462 template ·
463 typename ptr::mutator ptr::modify() const·
464 {·
465 if (obj_
466 return mutator(obj_);·
467 else·
468 throw Exception("Wt::Dbo::ptr: null dereference");·
469 }·

MP Updated by Mark Petryk about 8 years ago Actions #5

This is what I see now:

[2018-Sep-07 09:13:25.784] 22392 [/demo kY7zk9D9Vz7rBBay] [error] "Wt: error during event handling: Wt::Dbo::ptr: null dereference"
[2018-Sep-07 09:13:25.784] 22392 [/demo kY7zk9D9Vz7rBBay] [error] "Wt: fatal error: Wt::Dbo::ptr: null dereference"

This is perfect!

Actions

Also available in: PDF Atom