Skip to main content
18 events
when toggle format what by license comment
May 8, 2020 at 13:21 answer added Flater timeline score: 0
May 8, 2020 at 12:50 answer added GHP timeline score: 1
May 8, 2020 at 9:56 answer added Stilgar timeline score: 0
Apr 29, 2020 at 17:24 comment added Stilgar My current code uses exceptions but I really dislike the try/catch around each call :(
Apr 29, 2020 at 17:16 comment added Robert Harvey Personally, I like your response objects idea. If nothing else, you've actually fleshed it out more than the other ideas, and actually have code to prove it.
Apr 29, 2020 at 17:12 comment added Robert Harvey I do understand your question. Which one of your proposed solutions seems like the most workable one?
Apr 29, 2020 at 17:12 comment added Stilgar Well, I am only discussing the client here. The server is of course stateless, and the whole point of Blazor is to have stateful client experience (like desktop)
Apr 29, 2020 at 16:57 comment added Robert Harvey Well, it's hard to know without actually looking at your application. But good web applications generally have stateless qualities, regardless of the client tech. If there is state, the client handles it independently of the backend API. So yeah, there's probably a way. I doubt that it requires a message bus, though.
Apr 29, 2020 at 16:53 comment added Stilgar I am thinking of a message bus because the global exception handler doesn't know about the specific forms that need to be reenabled. The goal is not to have try/catch around the call in the form but have a single handler for the application. Even if I use the viewmodel how would the property be set assuming the exception handling logic is not in the viewmodel itself The client tech I am using is ASP.NET Blazor. To be fair I am not sure if it has a concept of global error handler at all.
Apr 29, 2020 at 16:48 comment added Robert Harvey Depending on your client-side technology, you might be able to use a binding on the appropriate controls. If I were writing this in WPF, I would put some logic in the View Model to set a boolean property that is bound to the Save button's "IsEnabled" property. Then, when the response comes back, if it is kosher, the save button automagically lights up.
Apr 29, 2020 at 16:46 comment added Robert Harvey if statements sound fine to me. Why complicate it with a message bus or even exceptions if you can simply use if statements?
Apr 29, 2020 at 16:42 comment added Stilgar Maybe but then what? Just wrap every call in try/catch and add the handling in each catch? I'd rather have ifs in this case. It seems to me that the exceptions approach would be good if I find a way to let them bubble up and use a common handler that works in all forms. Maybe a message bus and let the forms subscribe to messages and force them to have Unlock method which enables the controls?
Apr 29, 2020 at 16:26 comment added Robert Harvey I would put that kind of activity under the heading "handling an error." Which is exactly what exceptions are for.
Apr 29, 2020 at 16:10 comment added Stilgar I can't think of a practical case where I do anything but display the error to the user. However I don't want to "stop" work. I want to enable the form so he can try again or click something else. I don't want the app to crash (in the Blazor's case it would display the Reload button)
Apr 29, 2020 at 16:09 comment added Robert Harvey If you were not restrained by the maxim "don't use exceptions for flow control," would exceptions be your preferred mechanism here?
Apr 29, 2020 at 16:07 comment added Robert Harvey If you use exceptions, is their sole purpose to stop work and notify the user of an error, or does useful work (other than user notification) occur after any of the exceptions?
Apr 29, 2020 at 15:51 history edited Stilgar CC BY-SA 4.0
added 121 characters in body
Apr 29, 2020 at 15:33 history asked Stilgar CC BY-SA 4.0