Hi guys,

I recently made a big ticket/PR to Django, and Shai Berger told me I should 
first talk about it in this mailing list.

This is the ticket: https://code.djangoproject.com/ticket/31177 and its PR: 
https://github.com/django/django/pull/12339

It's a generalization of this ticket that I opened and wrote a patch for a 
few days ago: https://code.djangoproject.com/ticket/31166 It was discussed 
and merged.

Basically, I think that in any place where we catch an exception, and then 
wrap it with our own exception for whatever reason, we should use the 
"raise new_exception from old_exception" syntax rather than just "raise 
new_exception".

This means that when Python displays the stacktrace (and when we display it 
in the debug page,) this will make it have a text of "this exception is the 
direct result of" instead of "During handling of the above exception, 
another exception occurred". This is more accurate, because the latter 
basically means "there was an error in the process of error-handling," 
which is absolutely not the case for us, and could mislead a user.

Note that we already started transitioning to "raise from", slowly:
 - Commit by Mariusz Felisiak: 
https://github.com/django/django/commit/84dcd1624784c2239f96a97b3151145a85dfbbe3
 - Commit by Diederik van der Boor: 
https://github.com/django/django/commit/25f21bd2376603c8e233a0a0e5a726a0fdfdd33e
 - Commit by Thomas Allison: 
https://github.com/django/django/commit/3e8b7333904f1ab6aa18eeb508659256f3644816

What do you think? 


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/25086cdc-24ab-4f0a-bdb9-9756551ac170%40googlegroups.com.

Reply via email to