These are chat archives for damianh/Cedar

25th
Jun 2015
Ramon Prick
@Rprick
Jun 25 2015 08:11
I would like to return null in ResolveCommandType to indicate that I do not support the mediatype. Currently the only way to do this is throw an exception.
Yves Reynhout
@yreynhout
Jun 25 2015 09:20
Result objects, monads or exceptions ... anything but "null" would be my recommendation but I'll let @damianh be the judge.
Ramon Prick
@Rprick
Jun 25 2015 09:50
Agree, but I had to inspect the source code to see how exceptions during command type resolving were handled. Without that it was not clear whether you have to throw a certain exception or that any exception is handled.
João Bragança
@thefringeninja
Jun 25 2015 09:50
it could be documented better
IIRC it will automatically throw an HttpProblemDetailsException with the correct status code
Yves Reynhout
@yreynhout
Jun 25 2015 09:51
ResolveCommandType is a contract, so exceptions/acceptable return values should come with that. Young lib, give it a break.
João Bragança
@thefringeninja
Jun 25 2015 09:53
i think it's a framework. :trollface:
Damian Hickey
@damianh
Jun 25 2015 10:28
null is too loose:
  • I know of the media type, but I do not support it because it's deprecated
  • I have no idea what that media type is
  • I know of the media type, and I will support it in the future, but not now
@Rprick can you enlighten me on the scenario where you have a known, but unsupported, media type?
Yeah the whole project needs documentation, since there is a 1.0 out, I have no excuse.
Ramon Prick
@Rprick
Jun 25 2015 10:39
@damianh In my case it was scenario 2 (I have no idea what the media type type is). I receive a command name, but don't have a command registered with that (type) name.
Damian Hickey
@damianh
Jun 25 2015 10:50
In your opinion, is that a normal situation, or is it exceptional? or something else?
Damian Hickey
@damianh
Jun 25 2015 11:42
This will throw a yucky exception though. I'll improve this.
Ramon Prick
@Rprick
Jun 25 2015 12:18
Just back from a meeting. I think it is just a case you have to handle, but should be an exception. Normally you should still be able to handle situation where an old or obsolete command is requested. But in our case the old situation was using the full namespace and the new situation does not support this anymore. Only an unsupported old client could call it that way.
Dennis Doomen
@dennisdoomen
Jun 25 2015 12:21
In our case, a client can send any command to our HTTP, but until we map it to an internal command, we don't know whether it was a valid command name. So in my opinion, it's pretty normal that a client would pass a media type we can't resolve to an internal command. It would be pretty awesome if we would be able to expose a Swagger UI listing all the valid commands.
Yves Reynhout
@yreynhout
Jun 25 2015 15:59
@dennisdoomen it's your code, why not generate that off of your command classes?
Dennis Doomen
@dennisdoomen
Jun 25 2015 19:06
What? The Swagger stuff?