r/programming • • Oct 01 '17

Clever way of skirting game code quality tests from the 90s (x-post /r/Games)

https://youtu.be/i9bkKw32dGw
5.2k Upvotes

321 comments sorted by

View all comments

Show parent comments

46

u/RonaldHarding Oct 01 '17

Even bugs that are fixable may have an unreasonable time cost associated with them such that the simple solution of insert a catch all becomes far more economical. I'll always be the first to advocate for Engineering Excellence but programmers have to be reasonable about their scope. It's easy to think that there is a core problem which should be fixed, not always so easy to find and fix that core problem as ship dates get closer and closer.

11

u/Nyefan Oct 02 '17 edited Oct 02 '17

Yep. For example, when working REST services, I will handle all the errors I've thought of or encountered, but I'll still catch Exception just before returning so I can log everything and tell the client some unknown error has been encountered. Otherwise (in tomcat and wildfly, at least), the service will just spit the entire stack trace back at the client, potentially with sensitive information.

5

u/HooAreYou Oct 02 '17

jersey had a pretty simple mechanism for mapping exceptions to response codes. Any unmapped exception would still be caught and rethrown as a 500-internal error. Errors logged, stacktrace hidden, and lets you omit that try-catch structure on each endpoint

2

u/btcraig Oct 02 '17

I don't really work with Tomcat but that from an administration stand-point that seems like a pretty poor design choice by the Tomcat devs or a pretty poorly configured system. I can't think of any valid reason to ever dump the stack to an end-user unless that end-user is also debugging/QAing/etc the application, in which case I'd expect that to be a dedicated test/QA environment or in a 'test' mode only available to that user/user group.