掲示板

Code Exceptions Correctly...

thumbnail
9年前 に David H Nebinger によって更新されました。

Code Exceptions Correctly...

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
I really hate the stupid output for a Liferay exception:

null
com.liferay.portal.RequiredFieldException
    at ...


Why is it so freaking hard to actually code something into getMessage() or toString() that might actually make seeing those guys in the log worthwhile?
thumbnail
9年前 に Jorge Ferrer によって更新されました。

RE: Code Exceptions Correctly...

Liferay Legend 投稿: 2871 参加年月日: 06/08/31 最新の投稿
Fully agreed.

We have started some work to improve the information available in exceptions, which is useful for logging purposes but also to provide more valuable info in the UI. You can see some progress here: https://issues.liferay.com/browse/LPS-47130

However I must say that while working on this we ended up concluding that long term we should put our emphasis into a better API design that does validation in a different way. That's much more ambitious and probably won't make it into Liferay 7 but we will at least have a proof of concept.
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: Code Exceptions Correctly...

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
Glad to hear it's getting addressed, although it's not just the validation exceptions I'm concerned about. Many of the Liferay exceptions, as I'm sure you know, are basically treated like data containers to pass data from a bottom layer to an upper layer and therefore they lack a meaningful display value if logged even when the data they contain has value...
thumbnail
9年前 に Jorge Ferrer によって更新されました。

RE: Code Exceptions Correctly...

Liferay Legend 投稿: 2871 参加年月日: 06/08/31 最新の投稿
Hey David,

Yeah, if you look at the LPS I pointed too you will notice that the new pattern is for exceptions in general. I mentioned validation specifically since your example was about that and we will actually try to avoid exceptions for that in the far-future design.

BTW, if you have specific exceptions where you are seeing this negative effect let us know and we can try to prioritize doing those first.
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: Code Exceptions Correctly...

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
Jorge Ferrer:
BTW, if you have specific exceptions where you are seeing this negative effect let us know and we can try to prioritize doing those first.


Thanks, Jorge, I don't know what I did to deserve such prioritization, but I appreciate it emoticon