Project

General

Profile

Actions

Feature #6184

closed

know your dbo class on null

Added by Mark Petryk about 7 years ago. Updated over 6 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 }
Actions #1

Updated by Mark Petryk about 7 years ago

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.

Actions #2

Updated by Roel Standaert over 6 years ago

  • Target version changed from 3.3.10 to 3.3.11
Actions #3

Updated by Roel Standaert over 6 years ago

  • Status changed from New to Closed
Actions #4

Updated by Mark Petryk over 6 years ago

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 }·

Actions #5

Updated by Mark Petryk over 6 years ago

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: Atom PDF