bitflyer
2nd June 2010, 14:54
Are there any general guidelines about how to implement error handling in Qt code? What I mean are things like checking input parameters to functions and what to do in case of invalid parameters:
fail silently and do nothing?
return an error code as the result?
return 'false' and log an error message somewhere for the caller to get it?
emit a warning message and use a default value instead?
emit a warning and abort (Q_ASSERT, qFail(), ...)?
raise an exception?
or...?
Well I guess it depends also on the application what would be the correct action. Anyway, I haven't seen these issues discussed much in the Qt documentation, so I wanted to know if there are some common practices people usually follow?
fail silently and do nothing?
return an error code as the result?
return 'false' and log an error message somewhere for the caller to get it?
emit a warning message and use a default value instead?
emit a warning and abort (Q_ASSERT, qFail(), ...)?
raise an exception?
or...?
Well I guess it depends also on the application what would be the correct action. Anyway, I haven't seen these issues discussed much in the Qt documentation, so I wanted to know if there are some common practices people usually follow?