Add debug info to stack traces

If I call debug(str) in my backend code (and the website is in development mode?), the platform shall store the debug strings somewhere and incorporate them into the stacktrace if execution throws an error.